Add optional native Lance scan support#4633
Draft
wirybeaver wants to merge 6 commits into
Draft
Conversation
This was referenced Jun 12, 2026
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.
Which issue does this PR close?
Closes #4632.
Rationale for this change
Comet already has a native table-scan path for Iceberg. Lance tables are currently planned and read through Lance Spark. This prototype keeps Lance Spark as the Spark planning contract, then lets an optional Comet contrib reader detect Lance V2 scans, extract a stable descriptor from Lance Spark, and execute the assigned Lance fragments through native Rust Lance APIs.
The Lance Spark side of the descriptor contract is proposed in lance-format/lance-spark#624.
What changes are included in this PR?
contrib-lanceMaven profile and Rustcontrib-lancefeature.spark.comet.scan.lanceNative.enabled, disabled by default.BatchScanExecplans and delegate to contrib-lance when present and enabled.lance_scan = 118and split-mode payloads.LanceScanExecusing the Rust Lance API for dataset open, fragment selection, projection, filter SQL, limit/offset, batch size, and record batch streaming.This is intentionally a draft prototype. Minimal v1 scope is ordinary Lance table reads only. Index/search reads, namespace-backed credential refresh, metadata/version columns, aggregation pushdown, and production CI coverage are future phases.
Known blocker before this can be merge-ready: packaged Comet currently contains
org.apache.arrow.cclasses rewritten against Comet's shaded Arrow allocator, while Lance Spark expects the normal Arrow C Data ABI. A packaged Spark smoke with both jars exposes this classpath conflict. We need an explicit Arrow C Data packaging/classloader strategy for Comet + Lance Spark before merging a production-ready native Lance reader.How are these changes tested?
Passed:
~/.cargo/bin/cargo check -p datafusion-comet --no-default-features~/.cargo/bin/cargo check -p datafusion-comet --no-default-features --features contrib-lance./mvnw test -Dtest=none -Dsuites="org.apache.comet.rules.CometScanRuleSuite" -Pspark-4.1,contrib-lance -Dscalastyle.skip=true./mvnw package -DskipTests -Pspark-4.1,contrib-lance -Dscalastyle.skip=trueSmoke attempted:
source ~/uvenv/common/bin/activate && python /home/user/draft/comet_lance_native_smoke.pyThe smoke writes and reads a local Lance dataset, but packaged Comet + Lance Spark currently fails at runtime with an Arrow C Data ABI/classpath conflict as described above. The draft PR keeps that blocker visible for design review instead of hiding it behind unit-only coverage.