Commit 7a72a4c
perf(gfql/polars): reuse the synthetic edge id as the stable edge order
The native polars chain executor attaches a synthetic edge id (`EID`) via
`with_row_index` when the graph has no edge binding, then — a few hundred lines later —
materializes a SECOND `with_row_index` column (`EORD`) over that same frame to restore
eager edge order for the fused combine. Both are 0..n-1 over the same frame in the same
order, because the second runs on the frame the first produced, so the second is pure
duplication of a graph-sized materialization.
Reuse EID as EORD when it was attached. Both columns were already dropped before
returning, so the single drop now covers it (guarded on `EID != EORD` for the case where
the graph brought its own edge binding and EORD is still a separate column).
Measured on a 3.18M-node / 14M-edge polars graph with polars-engine indexes, a seeded
typed pattern: 148.22 -> 135.43 ms (-8.6%). `with_row_index` was ~34 ms/query across the
eager calls before this.
Parity: 108 polars-path cases (9 traversal shapes x 12 random seeds, engine='polars' with
polars-engine indexes) hashed over column ORDER, dtypes, row count and full content --
0 differ, 0 raised. This is a new sweep: the existing 650-case differential runs
engine=auto, which resolves to pandas and never exercises this executor.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VARwnAqmvczhz5EmP7TYyZ1 parent f180b3d commit 7a72a4c
1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
931 | | - | |
932 | | - | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
933 | 942 | | |
934 | 943 | | |
935 | 944 | | |
| |||
947 | 956 | | |
948 | 957 | | |
949 | 958 | | |
950 | | - | |
| 959 | + | |
| 960 | + | |
951 | 961 | | |
952 | 962 | | |
953 | 963 | | |
| |||
0 commit comments