Repository navigation
refactor(query)!: remove call subqueries - #227
Merged
Merged
Conversation
CALL subqueries are a Neo4j extension, not part of openCypher 9, and no
query in the benchmark suites uses them. Drop the parser rule, the AST
variant and its import helpers, the semantic checks, the logical Apply
and CallInput operators, the DataFusion builder and the ApplyExec
operator, along with the plan-cache bypass and planner state that only
CALL used.
A query with CALL { ... } or CALL proc() now raises an unsupported-feature
error naming the clause and its position, like write clauses do. The
Cypher reference shows openCypher forms of the common per-row uses.
BREAKING CHANGE: queries that use CALL { ... } no longer run.
Deploying lance-csr with
|
| Latest commit: |
4838555
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7ead4fbc.lance-csr.pages.dev |
| Branch Preview URL: | https://refactor-remove-call-subquer.lance-csr.pages.dev |
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.
Why
CALL { ... }subqueries are a Neo4j 4.0 extension (GQL has a similar inline call), not part of openCypher 9, and lance-csr positions itself as an openCypher engine. No query in the three benchmark suites uses them, yet they carried their own parser rule, semantic scope rules, a logicalApplyoperator, a per-row physical operator (ApplyExec) and special cases in the plan cache and the planner. Removing them shrinks the surface the planner work in #223 has to keep correct.Breaking change: a query that uses
CALL { ... }no longer runs.What changed
CALL { ... }and procedure-styleCALL name(...)now fail with the same unsupported-feature error as write clauses (NotImplementedErrorin Python), naming the clause and its position, instead of running or giving a parse error:A variable named
callis not mistaken for the clause.The CALL machinery is gone: the AST variant and its import helpers, the CALL scope checks, the
ApplyandCallInputlogical operators, the CALL-only planner state (preserve_entities, entity-preservingRETURN, cross-branch label checks), the DataFusion builder for it, andApplyNode/ApplyExec. The plan cache no longer has a CALL bypass. UNION type coercion, which CALL needed first, is kept, so UNION plans are unchanged.The Cypher reference replaces the "Read-only subqueries" section with openCypher forms of the common per-row uses (
OPTIONAL MATCHpluscount, a furtherMATCH, andcollect(...)[0]after a sortedWITH), with a runnable example. The overview, plan-cache, execution and internals pages, the Python docstring and the Rust crate README drop CALL.Tests: the CALL test module and Rust CALL unit tests are removed; the CALL cases in the path-value and timeout tests are dropped (the timeout test was specifically about CALL inheriting the deadline; a non-CALL expensive-query timeout test already exists). New tests in Rust and Python check the unsupported-feature error. The Node bindings never referenced CALL.
Validation
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --all --check: pass.python/:make install,make test(1817 passed, 5 skipped),make lint: pass.docs/check_snippets.pyruns every page; the new example prints the documented output.nodejs/:npm run build:native,npm run build,npm test(90 passed),npm run lint, and the node crate'scargo fmt --checkandcargo clippy -D warnings: pass. Generatednative.js/native.d.tsare unchanged.uv run --project docs --locked zensical build --strictanduvx typos@1.52.0 .: pass.docs/explain_plans.py(including the 100,000-person graph-benchmark sections) prints byte-identical output frommainand this branch, so the pasted plans need no update.Benchmarks
Following
CONTRIBUTING.md: release wheels formainat cd386ef (the engine code on currentmain; #226 only added the shape suite) and this branch, loaded withuv run --with,mainand branch alternated twice per mode, on an Apple M5 at a load average of about 3 to 5. Every suite query passed its expected-answer check and every shape-suite phrasing check passed.Plans: I captured
explain()for every SF1 query in both modes with both wheels. They match except IC3, whose two inline-property filters (name,type) print in a different order. That order comes from aHashMapand changes between processes onmainalone (four captures from themainwheel: threetypefirst, onenamefirst), so it is not caused by this change.Single-query moves: IC13 lazy shows -28%, but
main's two runs of it differ by 79%. The shape suite's largest move iswide_columns/all_idslazy at +14% (1.42 to 1.63 ms), equal tomain's own largest run-to-run gap in that mode. Nothing else moved by more than 10%.SF1 suites, every query
graph-benchmark-ldbc, memory
graph-benchmark-ldbc, lazy
graph-benchmark-ldbc-complex, memory
graph-benchmark-ldbc-complex, lazy
Shape suite report (`shapes.py report --base main --head branch`)
memory: small graph (20,000 accounts, 229,517 T edges, hub degrees [10, 1000, 10000, 100000])
Runs: main x2, branch x2.
main run-to-run geomean: 1.003; largest single-query gap 4%.
lazy: small graph (20,000 accounts, 229,517 T edges, hub degrees [10, 1000, 10000, 100000])
Runs: main x2, branch x2.
main run-to-run geomean: 1.001; largest single-query gap 14%.
🤖 Generated with Claude Code