fix: support new HugeGraph edge id format#349
Conversation
imbajin
left a comment
There was a problem hiding this comment.
The fix is in the right area, but the compatibility logic should mirror the java-client edge-id semantics more directly and lock the legacy path with a test.
| } | ||
|
|
||
| String[] parts = SplicingIdGenerator.split(edgeId); | ||
| if (parts.length == 4) { |
There was a problem hiding this comment.
❗️ High priority: please align this parser with the java-client edge-id invariant instead of hardcoding each length/index pair.
Context
- Legacy client 1.3 parsed the old 4-part id as
parts[2]. - Current toolchain java-client parses the permanent 5/6-part formats in
Edge.name()asidParts[idParts.length - 2]after validating the part count. - So the stable semantic is: Computer's edge name is the edge sort-values segment, i.e. the penultimate part of a valid edge id.
Risk
The current implementation encodes the same rule as 4 -> parts[2], 5 -> parts[3], and 6 -> parts[4]. That works for these examples, but it re-implements java-client parsing in a more fragile form and makes future format/client upgrades easier to drift.
Suggestion
Keep the compatibility range explicit, but extract through the shared invariant:
if (parts.length >= 4 && parts.length <= 6) {
return parts[parts.length - 2];
}Please also add a 4-part regression test beside the new 5/6-part tests, since this method explicitly preserves HugeGraph 1.3 compatibility but the current coverage only locks the new formats.
|
❗️ Please also update the CI HugeGraph environment after fixing the parser. 🔗 Reference: Context
Required update Please update the workflow to use the latest GRAPH_ENV_VERSION: 1.7.0Test completeness After that, the related coverage should prove both compatibility directions:
|
|
Updated in
Local checks: mvn -pl computer-test -am -Djacoco.skip=true -Dtest=HugeConverterTest -Dsurefire.failIfNoSpecifiedTests=false test
git diff --check -- .github/workflows/computer-ci.yml computer/computer-core/src/main/java/org/apache/hugegraph/computer/core/input/HugeConverter.java computer/computer-test/src/main/java/org/apache/hugegraph/computer/core/input/HugeConverterTest.javaThe new GitHub Actions runs are currently waiting for workflow approval ( |
There was a problem hiding this comment.
Blocking: yes. Summary: Legacy edge-id compatibility still depends on client-version behavior, and latest Computer CI is cancelled. Evidence: JDK 11 HugeConverterTest passed locally; current-head computer-ci cancelled.
🔗 Please check the cancelled current-head Computer CI run: https://github.com/apache/hugegraph-computer/actions/runs/27905173009/job/82572760266
|
|
||
| String[] parts = SplicingIdGenerator.split(edgeId); | ||
| if (parts.length == LEGACY_EDGE_ID_PARTS) { | ||
| return edge.name(); |
There was a problem hiding this comment.
convertEdgeName() already splits the id, but the 4-part branch still delegates to edge.name(). That only works with the current hugegraph-client 1.3.0 dependency; the current java-client implementation only accepts 5/6-part ids and derives the name from idParts[idParts.length - 2], so this compatibility shim will break for legacy ids when the client dependency is aligned with the 1.7.0 runtime that this PR now validates against.
Please return parts[2] for LEGACY_EDGE_ID_PARTS directly, or use the shared parts[parts.length - 2] invariant for all accepted arities, and leave edge.name() only for null or unknown formats.
Purpose of the PR
HugeGraph server now formats edge ids with 5 or 6 parts after the parent/child edge label change. The computer loader still called
Edge.name()from the older client, which expects exactly 4 parts and can fail while loading edges for algorithms such as LPA.Main Changes
HugeConverter.convertEdgeName()to read sort values from 4-part, 5-part, and 6-part edge ids.LoadServiceinstead of callingedge.name()directly.Verifying these changes
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need