Skip to content

feat(cpp): Add map-based AddPropertyColumn overload for EdgesBuilder#932

Open
SYaoJun wants to merge 1 commit into
apache:mainfrom
SYaoJun:june_2
Open

feat(cpp): Add map-based AddPropertyColumn overload for EdgesBuilder#932
SYaoJun wants to merge 1 commit into
apache:mainfrom
SYaoJun:june_2

Conversation

@SYaoJun

@SYaoJun SYaoJun commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Introduce a new AddPropertyColumn overload in EdgesBuilder that accepts unordered_map<pair<IdType, IdType>, any>, allowing users to set edge properties by (src_id, dst_id) key mapping.

Why are the changes needed?

The existing AddPropertyColumn takes a vector<any> where values[i] maps to the i-th edge in insertion order. This is fragile because it depends on the internal iteration order of unordered_map (not guaranteed by the standard) and requires the user to know the exact insertion order of edges.

The new map-based overload allows users to directly specify property values by (src, dst) pair, which is more intuitive and robust. Edges not present in the map simply won't have the property set (written as null).

Changes

  • edges_builder.h: Added new AddPropertyColumn(const std::string&, const unordered_map<pair<IdType,IdType>, any>&) overload
  • test_builder.cc: Added test case covering 4 edges with 3 mapped values and 1 deliberately omitted

Introduce a new AddPropertyColumn overload that accepts
unordered_map<pair<IdType, IdType>, any>, allowing users to
set edge properties by (src, dst) key mapping instead of
relying on insertion order. Edges not present in the map
will not have the property set.

Signed-off-by: Jason <libevent@yeah.net>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.40%. Comparing base (16f0a56) to head (cdf9480).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #932      +/-   ##
============================================
- Coverage     81.00%   77.40%   -3.61%     
  Complexity      615      615              
============================================
  Files            94       84      -10     
  Lines         10758     8958    -1800     
  Branches       1067     1070       +3     
============================================
- Hits           8715     6934    -1781     
+ Misses         1803     1784      -19     
  Partials        240      240              
Flag Coverage Δ
cpp 71.92% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants