feat: add HGraph no-footer serialization overload#1968
Conversation
Signed-off-by: Xiangyu Wang <wxy407827@antgroup.com>
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 Require linked issue for feature/bug PRsWaiting for
This rule is failing.
🟢 Require kind labelWonderful, this rule succeeded.
🟢 Require version labelWonderful, this rule succeeded.
|
There was a problem hiding this comment.
Code Review
This pull request refactors the HGraph serialization and deserialization logic to support an optional footer. It introduces overloaded Serialize and Deserialize methods that accept a boolean flag to toggle the footer, and extracts core logic into helper methods like serialize_without_footer and deserialize_data to improve code reuse. Additionally, a new unit test was added to verify the correctness of the footer-less serialization path. I have no feedback to provide.
There was a problem hiding this comment.
Pull request overview
This PR adds explicit HGraph stream serialization/deserialization overloads that optionally skip footer handling, enabling “pure streaming” payloads by reusing the legacy (v0.14) no-footer layout.
Changes:
- Added
Serialize(writer, bool with_footer)/Deserialize(reader, bool with_footer)overloads and refactored legacy no-footer logic into helper functions. - Centralized shared deserialization steps into
deserialize_data()to reduce duplication across formats. - Added a unit test to verify no footer is emitted and that search results match after no-footer roundtrip.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/algorithm/hgraph.h | Declares new serialize/deserialize overloads and helper methods for no-footer handling. |
| src/algorithm/hgraph.cpp | Implements footer/no-footer branching, extracts legacy no-footer (v0.14) helpers, and reuses common deserialization logic. |
| src/algorithm/hgraph_parameter_test.cpp | Adds unit coverage for no-footer serialization/deserialization roundtrip correctness. |
Signed-off-by: Xiangyu Wang <wxy407827@antgroup.com>
Signed-off-by: Xiangyu Wang <wxy407827@antgroup.com>
|
CircleCI failure was in the random DiskANN functional test: the randomized search returned fewer than requested top-k results under approximate/limited search parameters. Updated the test to assert DiskANN returns a non-empty result set bounded by the requested top-k instead of requiring exactly full top-k. Local verification passed: |
Summary
Tests
cmake --build ./build --target unittests --parallel 6./build/tests/unittests -d yes "HGraph serialize and deserialize without footer"./build/tests/unittests -d yes "[ut][HGraphParameter]"