imbajin commented on code in PR #349:
URL:
https://github.com/apache/hugegraph-computer/pull/349#discussion_r3448436267
##########
computer/computer-core/src/main/java/org/apache/hugegraph/computer/core/input/HugeConverter.java:
##########
@@ -96,4 +98,22 @@ public static Properties convertProperties(
}
return properties;
}
+
+ public static String convertEdgeName(Edge edge) {
+ E.checkArgumentNotNull(edge, "The edge can't be null");
+ String edgeId = edge.id();
+ if (edgeId == null) {
+ return edge.name();
+ }
+
+ String[] parts = SplicingIdGenerator.split(edgeId);
+ if (parts.length == 4) {
Review Comment:
🟡 The converter should express the same edge-id invariant used by
toolchain's java-client instead of hardcoding every supported length
separately. Computer still depends on toolchain/client 1.3.0, where
`Edge.name()` only accepted the legacy 4-part id and returned `parts[2]`. In
current
`hugegraph-toolchain/hugegraph-client/src/main/java/org/apache/hugegraph/structure/graph/Edge.java`,
`Edge.name()` accepts the permanent 5/6-part formats and returns
`idParts[idParts.length - 2]` after validating the count. So the shared
semantic is: the Computer edge name is the sort-values segment, i.e. the
penultimate part of a valid edge id.
Please consider keeping the legacy range check but extracting via that
invariant, for example:
```java
if (parts.length >= 4 && parts.length <= 6) {
return parts[parts.length - 2];
}
```
This also avoids drifting from the java-client implementation if the new
format is the long-term contract. Please add a 4-part regression test beside
the new 5/6-part tests, because this method explicitly preserves the old
HugeGraph 1.3 compatibility branch but the current test coverage only locks the
new formats.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]