Skip to content

refactor!: add lance-datafusion-exec so lance-index skips datafusion - #10251

Merged
wjones127 merged 1 commit into
mainfrom
split-lance-datafusion-exec
Oct 26, 2026
Merged

wjones127 merged 1 commit into
mainfrom
split-lance-datafusion-exec

Conversation

@wjones127

@wjones127 wjones127 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: lance_index::scalar::expression::PlannerIndexExt is removed. Use the free function create_filter_plan(expr, index_info, use_scalar_index), passing an expression already optimized with Planner::optimize_expr.

Summary

lance-index only used DataFusion sub-crate APIs, but it depended on the datafusion umbrella crate directly and through lance-datafusion, lance-index-core and lance-geo. So it could not start compiling until the umbrella crate finished. This PR moves what lance-index needs into a new lance-datafusion-exec crate built only on the sub-crates, so lance-index compiles in parallel with the umbrella crate.

 lance
 ├── lance-datafusion ── datafusion (umbrella)
-├── lance-index ─┬── lance-datafusion ── datafusion
-│                ├── lance-index-core ── datafusion
-│                └── lance-geo ── geodatafusion ── datafusion
+│   └── lance-datafusion-exec ── datafusion-{common,execution,expr,physical-expr,physical-plan,functions}
+├── lance-index ─┬── lance-datafusion-exec
+│                ├── lance-index-core ── datafusion-{common,execution,expr}
+│                └── lance-geo (no DataFusion)
  • lance-datafusion-exec holds the moved code: OneShotExec, StrictBatchSizeExec, HardCapBatchSizeExec, LanceExecutionOptions, the execution metrics helpers, chunker, utils, datagen, the contains_tokens and JSON UDFs, safe_coerce_scalar and column_names_in_expr. Its execute_plan runs under a TaskContext built from the options (memory pool, spill dir, batch size) with no registered functions, which is all lance-index's sort and merge plans need.
  • lance-datafusion re-exports the moved modules and items under their old paths. Its execute_plan still uses the cached SessionContext, so query execution in lance is unchanged. Both share execute_plan_with_context.
  • PlannerIndexExt needed Planner (SQL parsing, optimizer), so it is replaced by create_filter_plan, and lance calls Planner::optimize_expr first.
  • lance-geo drops its DataFusion dependency; lance-datafusion registers the geodatafusion UDFs itself, and the st_* relate-predicate wrappers from fix: evaluate constant-first spatial predicates correctly #10080 move from lance-geo/src/udf.rs to lance-datafusion/src/udf/geo.rs unchanged. lance_geo::register_functions is gone; lance_datafusion::udf::register_functions still registers everything. Splitting lance-geo's features was not enough, because workspace feature unification turned geo back on for lance-index's copy.

Evidence

Clean cargo build --workspace --timings, dev profile, 16 cores, rustc wrapper cache disabled, one run each. Times in seconds from build start.

main this PR
datafusion umbrella finishes 98.5 96.0
lance-index-core starts 96.9 42.6
lance-index starts 102.1 49.3
lance-index finishes 132.3 79.2
lance starts 121.6 98.7
total 249.7 222.2

lance now starts 2.7s after the umbrella crate finishes instead of 23.1s, so the umbrella crate is the only thing left on its critical path. Part of the 27.5s total difference is run-to-run noise (the shared DataFusion crates finished about 2.5s earlier in the PR run).

Merge Risk

Door: Two-way. No format or persisted-state change; the code moves are mechanical and the old lance-datafusion paths still resolve.
Blast Radius: public-api (PlannerIndexExt removal in lance-index), index training plans in lance-index now run under a function-less TaskContext, and geo UDF registration moved into lance-datafusion.

Fixes #10244

🤖 Generated with Claude Code

@github-actions github-actions Bot added breaking-change A-python Python bindings A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-deps Dependency updates and removed breaking-change labels Oct 22, 2026
@wjones127
wjones127 marked this pull request as ready for review October 22, 2026 20:04

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@wjones127

Copy link
Copy Markdown
Contributor Author

@westonpace @BubbleCal Does this align with how you think the crate deps should work?

I think a followup could move the RTREE index into lance-geo.

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 22, 2026
@Xuanwo

Xuanwo commented Oct 23, 2026

Copy link
Copy Markdown
Member

I love this change!

@wjones127
wjones127 force-pushed the split-lance-datafusion-exec branch from 06d91ad to 9cce633 Compare October 23, 2026 16:08
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 23, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The crate split removes the umbrella dependency from index compilation while retaining session-backed query execution. The rebase preserves the geo predicate fixes, per-row and NULL handling in contains_tokens, and zero-batch-size validation. Targeted execution, geo-registration, and scalar-filter tests passed, with no merge-blocking issue found.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 23, 2026
@wjones127
wjones127 force-pushed the split-lance-datafusion-exec branch from 9cce633 to 783c3ee Compare October 26, 2026 22:18
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 26, 2026
Move the parts of lance-datafusion that lance-index uses (exec nodes,
LanceExecutionOptions, chunker, stream utils, UDFs, scalar coercion,
column_names_in_expr, datagen) into a new lance-datafusion-exec crate
built only on DataFusion sub-crates. lance-datafusion re-exports them
under the same paths.

lance-index and lance-index-core now depend on DataFusion sub-crates
instead of the datafusion umbrella crate. lance-geo no longer depends on
DataFusion; lance-datafusion registers the geodatafusion UDFs itself, so
workspace feature unification does not pull the umbrella crate back in.

BREAKING CHANGE: lance_index::scalar::expression::PlannerIndexExt is
replaced by the free function create_filter_plan, which takes an
already-optimized expression. Call Planner::optimize_expr first.

Fixes #10244

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wjones127
wjones127 force-pushed the split-lance-datafusion-exec branch from 783c3ee to 983f3e8 Compare October 26, 2026 23:16
@wjones127
wjones127 merged commit 4158d49 into main Oct 26, 2026
39 checks passed
@wjones127
wjones127 deleted the split-lance-datafusion-exec branch October 26, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-deps Dependency updates A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-python Python bindings breaking-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split lance-datafusion so lance-index doesn't need datafusion crate

3 participants