Skip to content

query: honor SQL filters in explain plans - #84

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/fix-query-explain-sql-filter
Nov 21, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/fix-query-explain-sql-filter

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 21, 2026

Copy link
Copy Markdown
Member

Both lancedb_query_explain_plan and lancedb_vector_query_explain_plan only applied the stored DataFusion expression, so a query configured with lancedb_query_where_filter or lancedb_vector_query_where_filter explained a plan without its SQL predicate while execution applied it. Restore the SQL fallback after the DataFusion check, matching execution and the precedence already documented in the header.

Public C/C++ tests cover both query kinds: a valid SQL filter must appear in the plan, and a filter on a missing column must make EXPLAIN fail instead of returning an unfiltered plan. String literals use single quotes so the tests work with both the current SDK and the 0.42 upgrade.

Validation: cargo fmt --check, git diff --check, and g++ -fsyntax-only for both modified test files. Hosted CI will run the C++ suites; no local Rust build was run because another task holds the host build lease.

Apply the stored SQL filter when no DataFusion expression is set so the basic and vector EXPLAIN paths describe the same filtering as execution. Add public C/C++ checks for SQL predicate propagation and missing-column errors.
@Xuanwo
Xuanwo merged commit 6008334 into main Nov 21, 2026
7 checks passed
Xuanwo added a commit that referenced this pull request Nov 21, 2026
Main now propagates SQL predicates into explain plans (#84). Add a public where_filter plus postfilter explain section to the post-filter test, checking the predicate appears in both modes and the plans differ.
Xuanwo added a commit that referenced this pull request Nov 21, 2026
* bindings: add vector query post-filter

Expose lancedb_vector_query_postfilter(), mapping to the Rust SDK's postfilter() so a filter can run after the vector search. The default stays prefilter=true and the option applies to both execution and explain-plan.

Add coverage for prefilter vs postfilter row counts, explain-plan routing, and null-handle validation.

* query: copy postfilter before explain future

Own the postfilter flag before the explain path borrows the query into its async block, so the runtime rework can snapshot it with the other query parameters. Use single-quoted SQL literals in the new test, which both the 0.33 and 0.42 SDKs accept.

* tests: cover SQL filter with post-filter explain

Main now propagates SQL predicates into explain plans (#84). Add a public where_filter plus postfilter explain section to the post-filter test, checking the predicate appears in both modes and the plans differ.

* ci: drop Intel macOS from the package matrix

Xuanwo dropped Intel macOS support. Remove only the x86_64-apple-darwin matrix entry; the standalone packaging cleanup owns script and docs references.
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