feat(java, info): Unit test for loading graph
Describe the enhancement requested
Write unit test for java-info module, loading graph from test set, ensuring that info of:
- [ ] GraphInfo / VertexInfo / EdgeInfo
- [ ] PropertyGroup
- [ ] AdjacentList
- [ ] Property
are loaded as expected.
Can reference info test of C++ and info test of scala.
Component(s)
Java
I noticed that some interfaces in the Java code are not fully aligned with those in the C++ code. For example, the Java code is missing the vertexInfo::getPropertyGroupByIndex interface, which is available in the C++ code . Also, the current Java project depends on version v0.10.0 of the C++ code, which is quite outdated. Should we consider updating the Java project first?
I noticed that some interfaces in the Java code are not fully aligned with those in the C++ code. For example, the Java code is missing the
vertexInfo::getPropertyGroupByIndexinterface, which is available in the C++ code . Also, the current Java project depends on versionv0.10.0of the C++ code, which is quite outdated. Should we consider updating the Java project first?
Hi @yangxk1 , maybe there are some ambiguous expression. The java-info here refer to the info packages, rather than the original java package. You can reach out to us if there is any other problem : )
I noticed that some interfaces in the Java code are not fully aligned with those in the C++ code. For example, the Java code is missing the
vertexInfo::getPropertyGroupByIndexinterface, which is available in the C++ code . Also, the current Java project depends on versionv0.10.0of the C++ code, which is quite outdated. Should we consider updating the Java project first?Hi @yangxk1 , maybe there are some ambiguous expression. The
java-infohere refer to the info packages, rather than the original java package. You can reach out to us if there is any other problem : )
Thanks for your reply! I've opened a PR to improve the GraphLoaderTest#testLoad method in java-info.
While writing unit tests, I found three issues:
- Extra
/in path concatenation(e.g."vertex/person//id/") (minor). - Missing
getVersion()in GraphInfo, VertexInfo, and EdgeInfo (may affect usage). - Parameter order mismatch in EdgeInfo constructor vs. EdgeYaml#toEdgeInfo (this can lead to serious bugs). Specifically, In the constructor of EdgeInfo, the parameter srcChunkSize appears before chunkSize. However, in org.apache.graphar.info.yaml.EdgeYaml#toEdgeInfo, srcChunkSize is passed after chunkSize.
While writing unit tests, I found three issues:
- Extra
/in path concatenation(e.g."vertex/person//id/") (minor).- Missing
getVersion()in GraphInfo, VertexInfo, and EdgeInfo (may affect usage).- Parameter order mismatch in EdgeInfo constructor vs. EdgeYaml#toEdgeInfo (this can lead to serious bugs). Specifically, In the constructor of EdgeInfo, the parameter srcChunkSize appears before chunkSize. However, in org.apache.graphar.info.yaml.EdgeYaml#toEdgeInfo, srcChunkSize is passed after chunkSize.
Hi @yangxk1 , thanks for pointing it out:
-
Extra / in path concatenation: Thanks for pointing this out (e.g., "vertex/person//id/"). I'm not entirely sure where this redundant / might have been introduced in the path concatenation. If you've pinpointed the exact location in the code, a pull request to fix this would be welcome!
-
Missing getVersion() in GraphInfo, VertexInfo, and EdgeInfo: The getVersion() method wasn't included because the original proto files for these information classes did not define a version field. If having a version is important for your use case, please feel free to open a new, separate issue to propose this enhancement.
-
Parameter order mismatch in EdgeInfo constructor vs. EdgeYaml#toEdgeInfo: You are absolutely right about this! The discrepancy in parameter order (srcChunkSize and chunkSize) between the EdgeInfo constructor and the org.apache.graphar.info.yaml.EdgeYaml#toEdgeInfo method is a serious concern and could indeed lead to bugs. This is a perfect example of why increasing our unit test coverage is so important. Thank you for catching this critical detail!
(1) and (2). aren’t urgent. I’ll open an issue to fix (3).