fix: Support Returning Edge Properties Immediately After Edge Creation#309
Merged
Conversation
zhanglei1949
reviewed
May 6, 2026
zhanglei1949
reviewed
May 6, 2026
| virtual bool AddEdge(label_t src_label, vid_t src, label_t dst_label, | ||
| vid_t dst, label_t edge_label, | ||
| const std::vector<Property>& properties) override = 0; | ||
| virtual const void* AddEdge( |
Member
There was a problem hiding this comment.
Is there any better choice to wrap the returned edge, rather than returning a implementation-specific void* pointer?
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the edge insertion path so that AddEdge/put_edge can return a reference to the newly inserted edge’s payload, enabling Cypher CREATE ... RETURN e.<prop> to surface edge properties immediately after creation.
Changes:
- Change
AddEdgereturn types across storage/transaction layers to return an edge-data pointer/handle (and, internally, a{offset, ptr}pair). - Plumb the returned edge payload pointer into execution (
CreateEdge) so returned edge columns carry property access data. - Add a Python binding test asserting
RETURN e.sinceworks immediately afterCREATE.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/python_bind/tests/test_db_query.py | Adds coverage for returning an edge property immediately after edge creation. |
| src/transaction/update_transaction.cc | Updates update-transaction edge insertion to return the inserted edge payload pointer. |
| src/transaction/insert_transaction.cc | Updates insert-transaction edge insertion API to return a pointer-like success indicator. |
| src/storages/graph/property_graph.cc | Changes PropertyGraph::AddEdge to return {offset, data_ptr} from the underlying edge table. |
| src/storages/graph/graph_interface.cc | Updates AP update interface AddEdge to return the inserted edge payload pointer. |
| src/storages/graph/edge_table.cc | Propagates CSR put_generic_edge return pair and returns {oe_offset, data_ptr}. |
| src/execution/common/operators/insert/create_edge.cc | Stores returned edge payload pointer into edge columns so edge property accessors can read it. |
| include/neug/transaction/update_transaction.h | Updates update transaction and TP update interface AddEdge signatures to return const void*. |
| include/neug/transaction/insert_transaction.h | Updates insert transaction and TP insert interface AddEdge signatures/docs to return const void*. |
| include/neug/storages/graph/property_graph.h | Updates PropertyGraph::AddEdge signature to return std::pair<int32_t, const void*>. |
| include/neug/storages/graph/graph_interface.h | Updates StorageInsertInterface/StorageUpdateInterface AddEdge return types and documentation. |
| include/neug/storages/graph/edge_table.h | Updates EdgeTable::AddEdge signature to return {offset, data_ptr}. |
| include/neug/storages/csr/mutable_csr.h | Updates CSR put_edge implementations to return {prev_size, data_ptr}. |
| include/neug/storages/csr/csr_base.h | Updates CSR base virtuals to return {offset, data_ptr} pairs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
zhanglei1949
reviewed
May 8, 2026
|
|
||
| conn.execute("CREATE NODE TABLE person(id INT64, PRIMARY KEY(id));") | ||
| conn.execute( | ||
| "CREATE REL TABLE knows(FROM person TO person, since INT64, MANY_MANY);" |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the edge insertion API throughout the codebase to return additional information when adding edges. Instead of returning only a status or offset, the relevant
AddEdgeandput_edgemethods now return a pair containing the previous offset and a pointer to the edge data. This change provides more context to the caller and enables more advanced use cases, such as direct access to the newly inserted edge's data.