Repository navigation
Conversation
… batch
ScanRelTable initialised non-native rel tables before pulling any child
tuple, and its first scan() ran then too. A primary-key seed's chunk already
has one row at that point, with offset 0 in its vector, so the scan returned
that node's rels ahead of the real ones: over an Arrow rel table,
MATCH (p:P {id: 2})-[:p_x]->(x:X) returned x 1, 2, 3, 3, 4 instead of 3.
The scan now waits until a bound batch is in place and initScanState has run
for it, which also makes the early init unnecessary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adsharma
force-pushed
the
fix/arrow-pk-seed-first-scan
branch
from
November 11, 2026 01:15
b04e7f5 to
e3d19a7
Compare
This branch has not been deployed
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 work was produced with the help of language models.
Fixes #1527. Depends on #1528.
Over an Arrow rel table with p1→x1..x4 and p2→x3,
MATCH (p:P {id: 2})-[:p_x]->(x:X) RETURN x.idreturned1, 2, 3, 3, 4instead of3, and{id: 3}, which has no rels, counted 4. A primary-key seed returned the rels of the node table's first node on top of its own, in either direction and in both the flat and CSR layouts, since 0.19.0.Fix.
ScanRelTableinitialised non-native rel tables before pulling any child tuple, because its firstscan()ran before the first pull. A primary-key seed's chunk already holds one row at that point, with offset 0 in its vector. The scan now waits until a bound batch is in place andinitScanStatehas run for it, so the early init, which only made that first scan safe, is gone.Tests.
PrimaryKeySeedScansOnlyItsRelsruns the issue's queries, a backward seed (1, 1, 2for1, 2) and a prepared$idre-executed with different values.PrimaryKeySeedOverNativeNodesdoes the same for the CSR layout (3 rows for 1), andForkOverArrowRelTablesKeepsCrossProductnow also seeds a fork by primary key (48 for 24). All three fail on #1528's commit. The guard itself matters only for foreign and extension tables, which set up their scan ininitScanState, and this repo has no tests for those. Full ctest: 3406/3406.Cost. One branch per scan call, and one fewer
initScanStateper thread and execution. Alternating test builds on a graph of 2M nodes with 5 edges each, single-threaded instructions change by +1.30% on a filtered two-hop, inside its 4.7% run-to-run spread, and stay within 0.34% on the other queries.This branch is on top of #1528, so its diff shows #1528's commit until that merges.