Fix LocalRelTable insert for batched rel creation#412
Merged
Conversation
insert() was implicitly assuming 1 row per call: - It read only selVector()[0] for bound node(s). - It assigned a temp rel ID to only one position. - It pushed only one row index into local CSR index. But the query can create multiple rels in one vectorized insert call (e.g., two before -> x rows for PO), so multiple local rels could end up sharing/garbling temp IDs and index bookkeeping. That explains the duplicated local _ID (...7904) ### Fix - assign unique local rel IDs for every selected row (base + i) - validate bound-node nullability for every row/direction - append all rows - insert each appended row into each directed index using the matching selection position
LocalRelTable::insert() was still assuming aligned non-flat selection vectors after the previous batched insert fix. In practice, rel inserts can run with mixed vector states (e.g., flat src/dst vectors while the rel-id/property vector drives multiple rows), so indexing selVector()[i] directly on every vector is invalid and can misread/write rows. This broke merge/create rel paths in CI. Fix by driving numRowsToAppend from the rel-id vector selection, and resolving per-row positions per vector: use sel[0] for flat vectors, sel[i] for unflat vectors. Apply this consistently for bound-node null checks, local rel-id assignment, and directed index updates.
a0483c8 to
42b23f4
Compare
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.
Fixes: #378
insert() was implicitly assuming 1 row per call:
But the query can create multiple rels in one vectorized insert call (e.g., two before -> x rows for PO),
so multiple local rels could end up sharing/garbling temp IDs and index bookkeeping.
That explains the duplicated local _ID (...7904)
Fix