Skip to content

perf(gfql): use resident seed indexes in native Polars chains - #2038

Merged
lmeyerov merged 4 commits into
masterfrom
perf/gfql-polars-native-seed-resolution
Sep 5, 2026
Merged

lmeyerov merged 4 commits into
masterfrom
perf/gfql-polars-native-seed-resolution

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Native Polars op-list queries with named nodes, scalar edge filters, or a filtered destination fell through to the full traversal even when resident indexes could resolve the seed. Single-node native queries also scanned their seed predicates.

Reuse the shared seeded reduction for these directed one-hop shapes and the shared node resolver for single-node queries. The seeded lane serves only when the resident node-id and adjacency indexes cover the hop (validated once, passed into the reduction), runs after the polars index-policy consult so index_policy off/force/use and the engine-mismatch diagnostics are unchanged, and records an indexed_traversal step so gfql_explain reports the engagement. Indexed gathers preserve input table order; native aliases match the full Polars path. Unsupported shapes, alias/property collisions, duplicate node ids, and graphs without a usable index keep the existing full-path behavior; scalar filters raise the same structured schema errors as the full path.

Stacked on #2037. Fixes #2033.

Validation (head cdbcc64): polars lane bin/test-polars.sh 8,238 passed (4 failures are the local libcublas/dask environment, identical on the base); index contract + narrow-combine + seed-resolution + seeded-fast-path suites 436 passed; 33 pins in the new test file (explain/index_trace engagement, policy-off and no-index declines with full-path parity, duplicate-id decline, schema-error parity). Ruff, changed-file mypy, comment-density, type-hygiene, Cypher surface guard and diff checks pass. DGX measurements follow from a dedicated frozen checkout. Found while amplifying: #2039 (polars full path raises on an edge alias colliding with its filtered edge column).

lmeyerov added a commit that referenced this pull request Sep 5, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
lmeyerov added a commit that referenced this pull request Sep 5, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from 3a90313 to 47da761 Compare September 5, 2026 08:03
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from daa7348 to 994f4bd Compare September 5, 2026 08:03
lmeyerov added a commit that referenced this pull request Sep 5, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 994f4bd to 479a421 Compare September 5, 2026 08:36
@lmeyerov

lmeyerov commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

READY (479a421): 75/75 + RTD incl. tck-gfql; index-gated native polars seeded lane with engagement trace; start_nodes negative pin; real-GPU polars-gpu suites green. Stacked on #2037.

@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from 9b190d2 to 2eeaf99 Compare September 5, 2026 13:28
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 479a421 to 530afa4 Compare September 5, 2026 13:28
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from 2eeaf99 to bf9acb7 Compare September 5, 2026 13:29
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 530afa4 to 059b2a8 Compare September 5, 2026 13:29
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from bf9acb7 to 14be070 Compare September 5, 2026 13:36
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 059b2a8 to bf46a8a Compare September 5, 2026 13:37
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from 14be070 to 7f4e7a7 Compare September 5, 2026 13:42
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from bf46a8a to 86b7017 Compare September 5, 2026 13:42
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from 7f4e7a7 to e08a059 Compare September 5, 2026 13:44
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 86b7017 to 88ff625 Compare September 5, 2026 13:44
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from e08a059 to ab3a32e Compare September 5, 2026 14:23
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 88ff625 to 6312e18 Compare September 5, 2026 14:23
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from ab3a32e to ff818e1 Compare September 5, 2026 15:42
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 6312e18 to 0664c3a Compare September 5, 2026 15:42
@lmeyerov
lmeyerov force-pushed the perf/gfql-native-seed-resolution branch from ff818e1 to a45374b Compare September 5, 2026 16:33
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 0664c3a to 4a80847 Compare September 5, 2026 16:33
@lmeyerov

lmeyerov commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

READY (4a80847) — restacked on the new #2037 head after #2035 landed (patch-id identical to the previous head). This restack also drops a duplicated #2033 CHANGELOG bullet that an earlier union rebase had left (one bullet now).

Round-003 amplification (owner ask: reflect on the review flow before this lands) ran at this head: 51 shapes × pandas/polars/cuDF, default route vs the polars seed lane and the chain fast path forced to decline, plus the pandas full path as oracle. Polars cells: every served shape (_try_seeded_chain_polars engaged and the native_seeded_hop trace recorded) is value- and dtype-identical to the polars full path, including seed forms (None, absent, float, bool, label-only, two scalars, absent column), NULL-endpoint and dangling edges, string keys, categorical props, stale index, empty edge table, and declines for undirected / multi-hop / fixed-point / edge-first shapes. The only polars-vs-pandas differences (alias/column collisions rendered with _right suffixes; repeated node rows answered once per row) are identical on master and are not this lane.

Cost receipt (local box, medians of 7, ms; polars seeded typed hop [n({"id": k}, name="p"), e_forward({"type": ...}, name="e"), n(name="q")]): indexed 4.00 / 6.24 / 14.22 on master at 10k / 100k / 1M rows vs 1.88 / 1.65 / 1.74 here (flat in table size); unindexed 4.80 / 7.81 / 29.87 vs 4.88 / 8.14 / 26.26 (unchanged). Node lookup unchanged (~0.3 ms).

Receipts at 4a80847

lmeyerov and others added 4 commits September 5, 2026 11:33
…exes and records its engagement

The seeded shortcut ran before the polars index-policy consult and served
un-indexed shapes without a trace step, so gfql_explain lost the policy
off/force diagnostics and the engine-mismatch reason, the i1913 engagement
pin saw no index step, and a named seeded shape skipped the collect-once
combine. The lane now requires the resident node-id + adjacency indexes,
runs after the consult, and records an indexed_traversal step. Structured
schema errors and duplicate-id declines from the amplification pass are
kept and pinned.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
@lmeyerov
lmeyerov force-pushed the perf/gfql-polars-native-seed-resolution branch from 4a80847 to a3991bb Compare September 5, 2026 18:33
@lmeyerov

lmeyerov commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

CI at the rebased head a3991bb (on master 4c5e252 after #2037 landed): 77/77 check-runs success (tck-gfql, changed-line coverage, polars lane, hygiene guards included). Patch-id identical to the previous head 4a80847, so the GPU receipt (1331 passed, 3 failures identical to master, #2043) and the round-003 parity sweep carry over. Ready to merge; #2040 auto-retargets to master afterwards and I rebase it.

@lmeyerov
lmeyerov merged commit 8b208a6 into master Sep 5, 2026
78 checks passed
@lmeyerov
lmeyerov deleted the perf/gfql-polars-native-seed-resolution branch September 5, 2026 19:12
lmeyerov added a commit that referenced this pull request Sep 7, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
lmeyerov added a commit that referenced this pull request Sep 14, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
lmeyerov added a commit that referenced this pull request Sep 15, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
lmeyerov added a commit that referenced this pull request Sep 16, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
lmeyerov added a commit that referenced this pull request Sep 17, 2026
…index-resolved seeds

Vendors pyg-bench published/docs-numbers.json at main 5cf81ae (byte-identical):
the SF0.1 indexed GFQL cells come from the #2038 head with the pre-landing
disclosure, SF1 stays the release measurement. The SNB prose states the
native op-list arm, where the resident indexes now engage, the hop rows they
do not change, and the open issues behind the remaining gaps. Release-notes
Performance paragraph names the native seed resolution and the sentinel's
native op-list points.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_014RhboAkmjP5eXbCCkX1BMt
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.

perf(gfql): polars native chain for a seeded typed 1-hop does not take the seeded fast path (3-4x slower than the same Cypher)

1 participant