Skip to content

Fix shadow-table scan link and add SQL pushdown coverage - #88

Merged
adsharma merged 1 commit into
LadybugDB:mainfrom
adsharma:feature/sql-pushdown-extended
Sep 20, 2026
Merged

adsharma merged 1 commit into
LadybugDB:mainfrom
adsharma:feature/sql-pushdown-extended

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Stacked on the DuckLake pushdown work (first commit below belongs to that series; this PR's change is the last commit).

Fix: moved-from pointer disabled all pushdown over attached node tables

In DuckDBCatalog::createForeignTable, the attached entry pointer was read back from the unique_ptr after moving it into the catalog, so it was always null. The shadow node entry's referencedEntry was therefore null, getBoundScanInfo() returned null, and the planner emitted plain SCAN_NODE_TABLE instead of a pushdown-capable TABLE_FUNCTION_CALL — silently disabling the entire foreign join pushdown (and failing MATCH traversal) for DuckDB-attached node tables. Fixed by capturing the raw pointer before the move (the catalog takes ownership, so it stays valid).

Tests

Adds the pushdown_graph.db fixture (person/city nodes, knows/likes/lives-in rels with FKs) and sql_pushdown.test covering:

  • 1-hop baseline with ORDER BY
  • 2-hop with node filter (a.age > 30)
  • 2-hop with edge filters (r1.since, r2.score)
  • 2-hop across mixed node labels (person -> city)
  • aggregation + ORDER BY (count(*) + ORDER BY cnt DESC)
  • recursive CTE (-[e:rel_knows*1..3]->)
  • recursive with inline edge filter (-[e:rel_knows*1..2 {since: 2020}]->)

Every MATCH here runs over rel_* tables, whose local traversal errors out, so each passing result proves the pattern pushed to SQL. Requires the companion engine change (ladybug PR) for the multi-hop/agg/recursive cases; the 1-hop cases pass with this fix alone.

CI: run the rest on CI (make extension-test needs the RelWithDebInfo extension tree).

Capture the attached entry pointer before moving it into the catalog:
reading it back from the moved-from unique_ptr always yielded null, so
shadow node entries never exposed their scan function and no Cypher query
over attached DuckDB node tables could plan a table-function scan (which
also silently disabled all foreign join pushdown).

Add pushdown_graph.db fixture plus sql_pushdown.test covering 1-hop, 2-hop
with node/edge filters, aggregation + ORDER BY, and recursive-CTE
pushdown.
@adsharma
adsharma force-pushed the feature/sql-pushdown-extended branch from b4de6c1 to f09f80b Compare September 20, 2026 04:38
@adsharma
adsharma merged commit cfb0501 into LadybugDB:main Sep 20, 2026
3 of 4 checks passed
@adsharma
adsharma deleted the feature/sql-pushdown-extended branch September 20, 2026 16:03
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.

1 participant