incubator-graphar icon indicating copy to clipboard operation
incubator-graphar copied to clipboard

feat(java, info): Unit test for loading graph

Open Thespica opened this issue 10 months ago • 2 comments

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

Thespica avatar Apr 11 '25 05:04 Thespica

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?

yangxk1 avatar Apr 24 '25 07:04 yangxk1

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?

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 : )

Thespica avatar Apr 25 '25 02:04 Thespica

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?

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 : )

Thanks for your reply! I've opened a PR to improve the GraphLoaderTest#testLoad method in java-info.

yangxk1 avatar May 20 '25 08:05 yangxk1

While writing unit tests, I found three issues:

  1. Extra / in path concatenation(e.g. "vertex/person//id/") (minor).
  2. Missing getVersion() in GraphInfo, VertexInfo, and EdgeInfo (may affect usage).
  3. 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.

yangxk1 avatar May 20 '25 08:05 yangxk1

While writing unit tests, I found three issues:

  1. Extra / in path concatenation(e.g. "vertex/person//id/") (minor).
  2. Missing getVersion() in GraphInfo, VertexInfo, and EdgeInfo (may affect usage).
  3. 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:

  1. 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!

  2. 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.

  3. 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!

Thespica avatar May 23 '25 10:05 Thespica

(1) and (2). aren’t urgent. I’ll open an issue to fix (3).

yangxk1 avatar May 23 '25 11:05 yangxk1