Skip to content

chore: upgrade DataFusion to 55 and Arrow to 59 - #10397

Merged
Xuanwo merged 12 commits into
mainfrom
xuanwo/datafusion-55
Oct 28, 2026
Merged

Xuanwo merged 12 commits into
mainfrom
xuanwo/datafusion-55

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Closes #9647.

DataFusion 55 and Arrow 59 require a coordinated upgrade across the Rust workspace, Python bindings, and Java JNI crate. This PR carries the original implementation forward, resolves its conflicts with the current main, and adapts the remaining execution-plan, spill, and binding APIs to DataFusion 55.

This replaces #9979 because that branch is owned by an organization where the maintainer cannot push. The original commit authors are preserved in the branch history; the trailers at the end of this description also retain their credit if the PR is squash-merged.

Behavior changes

  • Migrate execution-plan expression reporting, statistics, planning contexts, optimizer composition, and AnalyzeExec construction to DataFusion 55.
  • Preserve full-text-search ordering during the EnforceDistribution removal, align indexed and hash-join signed-zero matching, and keep Arrow 59 map copying behavior compatible with existing data.
  • Use DataFusion 55's public SpillFile API and refresh the Rust, Python, Java, and Python dependency lockfiles.
  • Package the local Arrow helper crates in CI while their 59.0.0 versions are not yet on crates.io.

Verification

  • cargo fmt --all -- --check
  • cargo clippy --all --tests --benches -- -D warnings
  • cargo check --workspace --tests --benches, including --all-features
  • cargo package --workspace --no-verify --all-features
  • Targeted Rust tests for DataFusion, spill handling, merge-insert behavior, Arrow ordering, count pushdown, top-k late materialization, full-text search, and execution plans
  • Python make install, uv run make lint, and test_table_provider.py
  • Java JNI clippy, Spotless, and ./mvnw test

Thanks to @timsaucer for the original implementation and careful behavior analysis, and to @slachiewicz, @wjones127 for the review, signed-zero discussion, and follow-up coverage. Their contributions and review history made this upgrade possible.

Co-authored-by: Sylwester Lachiewicz [email protected]
Co-authored-by: Tim Saucer [email protected]

timsaucer and others added 11 commits October 13, 2026 12:18
Bump DataFusion 54 -> 55 and Arrow 58 -> 59.2 across the Rust workspace,
the Python bindings and the Java JNI crate, along with the dependencies
that must move in lockstep: geodatafusion 0.6, geoarrow 0.9, pyo3 0.29
and pythonize 0.29. The Python `datafusion` requirement moves to
`>=55,<56` so the datafusion-python major version matches the
datafusion-ffi version pylance is built against.

Migration for DataFusion 55 breaking changes:

- Implement the now-required `ExecutionPlan::apply_expressions`. Nodes
  that own physical expressions (FilteredReadExec, LanceFilterExec,
  CountFromMaskExec and the memtable scan nodes) report them.
- Migrate statistics from the deprecated `partition_statistics` to
  `child_stats_requests` + `statistics_from_inputs`, and compute stats
  through `StatisticsContext` in callers and tests.
- Replace deprecated `with_new_children` calls with
  `replace_children_if_necessary` (or `replace_children` in tests that
  deliberately rebuild a node).
- Pass a `PhysicalPlanningContext` to `create_physical_expr` and
  `LoweredAggregateBuilder`, and update `ExtensionPlanner::plan_extension`.
- Build `AnalyzeExec` through its builder.
- `EnforceDistribution` was removed; use `EnsureRequirements`.
- The execution batch size is now a `ConfigNonZeroUsize`, so a zero
  `LanceExecutionOptions::batch_size` is rejected with an invalid-input
  error instead of panicking inside DataFusion.

Arrow 59 / pyo3 0.29 follow-ups: `MutableArrayData::try_extend` and
`PyCapsule::new_with_value`. The arrow-scalar and arrow-stats crate
versions track the Arrow major version.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Follow-up to the DataFusion 55 / Arrow 59 upgrade, fixing the test
regressions it introduced.

- Keep distribution-only physical optimization. DataFusion 55 folded
  `EnforceDistribution` into `EnsureRequirements`, which also enforces
  sort requirements and drops sorts that no parent declares it needs.
  Many Lance nodes (e.g. `TakeExec`) do not declare whether they
  maintain input order, so that rule removed the score sort under
  full-text search results. Rebuild the old rule from DataFusion's
  public pieces until those nodes declare their ordering (#9647).
- Build `project()` with the requested schema's metadata. DataFusion 55's
  `UnionExec` relabels any input whose schema metadata differs from the
  union's, which added a no-op projection over scalar-index union arms.
- Treat `-0.0` and `+0.0` as the same merge-insert key. DataFusion 55's
  hash join now matches float keys per IEEE 754, so the indexed lookup
  probes both zero encodings to agree with it (and with Lance filters).
- Copy rows of maps whose entries break the Arrow spec without
  validation. Arrow 59's `take` rebuilds maps through the validating
  `MapArray::try_new`, which rejected exactly the maps the blank-row
  `Take` fallback exists for.
- Build the relabelling cast explicitly in the MemWAL index filter test,
  since DataFusion 55 no longer casts a column whose nested field
  metadata differs from a list literal's.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Resolve conflicts with main and port its new code to DataFusion 55 and
Arrow 59: MergeConditionExec now takes a `&dyn Session` and reports its
conditions via apply_expressions, OrderedConcatExec gains
apply_expressions, the row-offset statistics fix moves into
statistics_from_inputs, and planar sparse pages use try_extend.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
-0.0 and +0.0 are one key now, so a source holding both matches each zero
target row twice: Fail rejects it as ambiguous, FirstSeen updates each once.
Also note in compact_blank_source why its validating take is safe.
Hide the signed_zero module from docs since it is public only for
internal reuse, and keep the with_new_children doc comment on
TakeExec::with_new_children.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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.

@github-actions github-actions Bot added chore A-python Python bindings A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-deps Dependency updates A-encoding Encoding, IO, file reader/writer A-ci CI / build workflows labels Oct 28, 2026
@Xuanwo
Xuanwo requested a review from wjones127 October 28, 2026 06:03
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 28, 2026
DataFusion 55 normalizes -0.0 and +0.0 before equality comparisons. BTree lookup used Arrow's total-order comparison for page selection and key grouping, so it could miss a page or return only one zero encoding.\n\nUse the same zero normalization for float page bounds and before hashing lookup keys and page values. Add a two-page regression test.
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 28, 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.

Btree lookup now applies signed-zero equality consistently to page selection and row matching, including zeros split across pages.

Keeping distribution-only optimization preserves the existing full-text-search ordering. Adopting EnsureRequirements can follow the ordering audit discussed in #9647.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 28, 2026
@Xuanwo
Xuanwo merged commit 3527221 into main Oct 28, 2026
41 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/datafusion-55 branch October 28, 2026 07:18
Xuanwo added a commit that referenced this pull request Nov 23, 2026
…arrow (#11294)

cc @westonpace — opening this PR to consolidate `lance-arrow-scalar` and
`lance-arrow-stats` into `lance-arrow` ahead of the `v15.0.0` release.
Happy to hear your thoughts if you still want to keep them as standalone
Arrow-versioned crates!

## Context

While preparing the `v15.0.0` stable release, we hit a hard Rust publish
blocker:

1. **Blocked `v15.0.0` crates.io publish**: `#10397` bumped
`lance-arrow-scalar` and `lance-arrow-stats` to `59.0.0` (pinned via
`=59.0.0` in the root `Cargo.toml`), while crates.io still only has
`58.0.0`. `.github/workflows/cargo-publish.yml` excludes both crates
(`--exclude lance-arrow-stats --exclude lance-arrow-scalar`), and there
is no other publish workflow, so `cargo publish --workspace` fails
immediately when resolving `lance-index`.
2. **Silent source drift on crates.io**: Because these two crates track
Arrow's major version instead of `workspace.package.version` and were
excluded after `#6972`, changes in `#6808` (`ArrowScalar::is_nan`) and
`#7966` (`Decimal128/Decimal256` min/max stats) landed without bumping
`58.0.0`. Rust users installing `lance 8.x–14.0.3` from crates.io
received the stale May `58.0.0` tarball instead of the workspace source,
and `#10102` added further Lance-specific ZoneMap seed NaN tracking on
top.
3. **Zero external usage & single-owner publishing**: On crates.io, both
crates have only internal Lance reverse dependencies
(`lance-arrow-stats`, `lance-index`, `lance`) and a single crate owner
(missing `github:lancedb:release`).
4. **Original goal still holds in `lance-arrow`**: The original
motivation in `#5955` / `#5967` was to avoid pulling DataFusion into
lower-level crates. `lance-arrow` has zero DataFusion dependencies, is
already depended on by `lance-encoding`, `lance-file`, `lance-core`, and
`lance-index`, and follows `workspace.package.version` cleanly.

Since `v15.0.0` is already a breaking major (Arrow 59 / DataFusion 55)
and crates.io SemVer prevents downgrading `59.0.0` back to `15.0.0`
under the old crate names, merging them into `lance-arrow` removes the
dual-track versioning and publish exclusions cleanly.

## Changes

- Move `ArrowScalar` (and its `From` conversions) into
`lance_arrow::scalar::ArrowScalar` (`rust/lance-arrow/src/scalar/`).
- Drop the unused custom binary scalar codec
(`rust/arrow-scalar/src/serde.rs`, 558 lines with zero callers outside
its own unit tests).
- Move `StatisticsAccumulator`, `Statistics`, `NanCounts`, `count_nans`,
and `count_nans_signed` into `lance_arrow::stats`
(`rust/lance-arrow/src/stats.rs` and
`rust/lance-arrow/src/stats/nan.rs`), along with its proptest regression
seeds (`rust/lance-arrow/proptest-regressions/stats.txt`).
- Add `arrow-cast` and `arrow-row` to `rust/lance-arrow/Cargo.toml`
(both are already workspace Arrow dependencies; `lance-arrow` remains
free of DataFusion).
- Update internal callers (`lance-index` zonemap/bloomfilter and
`rust/lance/tests/arrow_ordering.rs`) and remove `rust/arrow-scalar` and
`rust/arrow-stats` from the workspace and all three lockfiles
(`Cargo.lock`, `python/Cargo.lock`, `java/lance-jni/Cargo.lock`).
- Drop `--exclude lance-arrow-stats --exclude lance-arrow-scalar` from
`.github/workflows/cargo-publish.yml`, and update the
`arrow-ordering-compat` path trigger in `.github/workflows/rust.yml` and
`rust/AGENTS.md`.

## Notes on `arrow-ordering-compat`

No ordering expectations in `rust/lance/tests/arrow_ordering.rs`
changed—only the two `use` imports were updated from
`lance_arrow_scalar` / `lance_arrow_stats` to `lance_arrow::scalar` /
`lance_arrow::stats`. Because the base branch's copy of
`arrow_ordering.rs` still references the removed crates, the base-branch
compile check in `arrow-ordering-compat` will need the
`arrow-ordering-reviewed` label once reviewed.

## Verification

- `cargo fmt --all -- --check`
- `cargo test --profile ci --locked -p lance-arrow` (366 passed,
including 34 `scalar::arrow_scalar`, 4 `scalar::convert`, 64 `stats::`,
and 9 doctests)
- `cargo test --profile ci --locked -p lance-index --lib
'scalar::zonemap::tests'` (85 passed) and `'scalar::bloomfilter::tests'`
(36 passed)
- `cargo test --profile ci --locked -p lance --test arrow_ordering` (46
passed)
- `RUSTDOCFLAGS="-D warnings" cargo doc --profile ci --locked --no-deps
-p lance-arrow`
- `cargo clippy --profile ci --locked --all --tests --benches -- -D
warnings`
- `cargo clippy --profile ci --locked -p lance --test arrow_ordering --
-D warnings`
- `cargo package --workspace --no-verify --all-features` and `cargo
publish --workspace --all-features --dry-run --no-verify` (all 28
workspace crates resolve and pass dry-run)
- `cargo metadata --frozen` verified across `Cargo.toml`,
`python/Cargo.toml`, and `java/lance-jni/Cargo.toml`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ci CI / build workflows A-deps Dependency updates A-encoding Encoding, IO, file reader/writer A-index Vector index, linalg, tokenizer A-java Java bindings + JNI A-python Python bindings breaking-change chore K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: upgrade to Arrow 59 and DataFusion 55

4 participants