Skip to content

chore: upgrade Rust toolchain to 1.97.0#7712

Merged
wjones127 merged 1 commit into
lance-format:mainfrom
wjones127:chore/upgrade-rust-1.97
Jul 10, 2026
Merged

chore: upgrade Rust toolchain to 1.97.0#7712
wjones127 merged 1 commit into
lance-format:mainfrom
wjones127:chore/upgrade-rust-1.97

Conversation

@wjones127

@wjones127 wjones127 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Bumps the pinned toolchain from 1.94.0 to 1.97.0 in rust-toolchain.toml (the python/ and java/lance-jni/ copies are symlinks to it) and fixes the clippy lints newly reported by 1.97 across the workspace.

New lints fixed:

  • manual_filter, manual_checked_ops, question_mark
  • useless_conversion, useless_borrows_in_formatting
  • collapsible_match, while_let_loop, explicit_counter_loop, unnecessary_sort_by

All fixes are behavior-preserving. cargo clippy -- -D warnings is clean across the main workspace (all features, all targets), python/, and java/lance-jni/; cargo fmt --check passes on all three.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of floating-point NaN values in range queries for more conservative, reliable results.
    • Prevented potential division-by-zero issues in decoding and statistics calculations.
    • Preserved correct behavior when processing all-null data and missing fields.
  • Maintenance

    • Updated the Rust toolchain used to build the project.
    • Simplified internal processing across indexing, scanning, encoding, storage, and query-planning components without changing expected behavior.

Bumps the pinned toolchain from 1.94.0 to 1.97.0 in rust-toolchain.toml
(python/ and java/lance-jni/ symlink to it) and fixes the clippy lints
newly reported by 1.97 across the workspace:

- manual_filter, manual_checked_ops, question_mark
- useless_conversion, useless_borrows_in_formatting
- collapsible_match, while_let_loop, explicit_counter_loop,
  unnecessary_sort_by

All fixes are behavior-preserving. Clippy is clean with `-D warnings`
across the main workspace (all features, all targets), python, and java.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request pins Rust 1.97.0 and applies behavior-preserving Rust idiom updates across encoding, DataFusion, indexing, dataset, I/O, namespace, and test code. It also replaces several manual zero-division guards with checked division.

Changes

Rust modernization

Layer / File(s) Summary
Core streaming and encoding idioms
rust-toolchain.toml, rust/lance-arrow/..., rust/lance-encoding/..., rust/lance-file/..., rust/lance-io/..., rust/lance-table/..., rust/lance/benches/...
The toolchain is updated to 1.97.0, while iterator usage, upload matching, validity handling, row selection, and ratio calculations are simplified.
Expression and planning control flow
rust/lance-datafusion/..., rust/lance-index/src/scalar/zonemap.rs, rust/lance-index/src/scalar/btree/flat.rs, rust/lance/src/io/exec/...
Guarded match arms and ? short-circuiting replace nested conditionals while preserving field resolution, NaN handling, range matching, and wrapper traversal.
Index and vector iterator updates
rust/lance-index/..., rust/lance/src/index/vector/...
Bitmap merging, iterator construction, vector storage concatenation, row remapping, and test sorting are rewritten using direct collection iteration or key-based sorting.
Dataset lifecycle and write paths
rust/lance/src/dataset/..., rust/lance/src/io/commit.rs
Dataset validation, cleanup, writes, statistics, compaction, references, scanning, merge deletion, and duplicate field-ID mapping use simplified ownership, iteration, and checked-division expressions.
Namespace path and ordering expressions
rust/lance-namespace-impls/src/dir.rs
Descending version sorting uses sort_by_key with Reverse, and URI formatting passes the root value directly.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: upgrading the Rust toolchain to 1.97.0.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer A-encoding Encoding, IO, file reader/writer A-namespace Namespace impls chore labels Jul 9, 2026
@wjones127
wjones127 marked this pull request as ready for review July 9, 2026 22:52
@wjones127
wjones127 requested a review from BubbleCal July 9, 2026 22:53

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@rust/lance-index/src/scalar/bitmap.rs`:
- Line 894: Remove the intermediate Vec allocation in the
ScalarValue::iter_to_array call by passing self.keys.drain(..) directly,
preserving the existing behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0ab4db73-bb92-422c-be61-2fd0c234d00f

📥 Commits

Reviewing files that changed from the base of the PR and between 0bdf0a1 and 9fab586.

📒 Files selected for processing (36)
  • rust-toolchain.toml
  • rust/lance-arrow/src/lib.rs
  • rust/lance-datafusion/src/logical_expr.rs
  • rust/lance-datafusion/src/planner.rs
  • rust/lance-encoding/src/decoder.rs
  • rust/lance-encoding/src/encodings/physical/packed.rs
  • rust/lance-encoding/src/previous/encodings/logical/blob.rs
  • rust/lance-file/src/reader.rs
  • rust/lance-index/src/scalar/bitmap.rs
  • rust/lance-index/src/scalar/btree.rs
  • rust/lance-index/src/scalar/btree/flat.rs
  • rust/lance-index/src/scalar/fmindex.rs
  • rust/lance-index/src/scalar/inverted.rs
  • rust/lance-index/src/scalar/zonemap.rs
  • rust/lance-index/src/vector/bq/storage.rs
  • rust/lance-index/src/vector/flat/index.rs
  • rust/lance-index/src/vector/flat/storage.rs
  • rust/lance-io/src/object_writer.rs
  • rust/lance-namespace-impls/src/dir.rs
  • rust/lance-table/src/rowids.rs
  • rust/lance/benches/s3_file_reader_diagnostics.rs
  • rust/lance/src/dataset.rs
  • rust/lance/src/dataset/blob.rs
  • rust/lance/src/dataset/cleanup.rs
  • rust/lance/src/dataset/fragment/write.rs
  • rust/lance/src/dataset/mem_wal/write.rs
  • rust/lance/src/dataset/optimize.rs
  • rust/lance/src/dataset/refs.rs
  • rust/lance/src/dataset/scanner.rs
  • rust/lance/src/dataset/write/merge_insert.rs
  • rust/lance/src/index/vector/ivf.rs
  • rust/lance/src/index/vector/ivf/v2.rs
  • rust/lance/src/io/commit.rs
  • rust/lance/src/io/exec/count_pushdown.rs
  • rust/lance/src/io/exec/fts.rs
  • rust/lance/src/io/exec/projection.rs

let keys_array =
ScalarValue::iter_to_array(self.keys.drain(..).collect::<Vec<_>>().into_iter())
.unwrap();
ScalarValue::iter_to_array(self.keys.drain(..).collect::<Vec<_>>()).unwrap();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C 4 'fn iter_to_array|iter_to_array\(' \
  rust Cargo.toml Cargo.lock \
  "${CARGO_HOME:-$HOME/.cargo}/registry/src" 2>/dev/null || true

Repository: lance-format/lance

Length of output: 9752


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the exact ScalarValue::iter_to_array definition and any nearby iterator bounds.
rg -n -C 6 'pub fn iter_to_array|fn iter_to_array|iter_to_array<|IntoIterator' \
  rust "${CARGO_HOME:-$HOME/.cargo}/registry/src" 2>/dev/null | head -n 200

# Show the relevant bitmap writer block for context.
sed -n '880,905p' rust/lance-index/src/scalar/bitmap.rs

# Check whether drain(..) is already used directly with iter_to_array elsewhere in the repo.
rg -n 'iter_to_array\([^)]*drain\(' rust/lance-index rust/lance 2>/dev/null || true

Repository: lance-format/lance

Length of output: 13036


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the exact definition/signature of ScalarValue::iter_to_array.
rg -n -C 5 'iter_to_array' \
  rust "${CARGO_HOME:-$HOME/.cargo}/registry/src" \
  -g '*.rs' 2>/dev/null | head -n 200

# Show the surrounding implementation in the repository where the bad allocation occurs.
sed -n '888,900p' rust/lance-index/src/scalar/bitmap.rs

# Show nearby call sites that already pass iterators directly.
sed -n '1268,1305p' rust/lance-index/src/scalar/bitmap.rs

Repository: lance-format/lance

Length of output: 11594


Avoid the extra Vec allocation here.
ScalarValue::iter_to_array already accepts an IntoIterator, so self.keys.drain(..) can be passed directly instead of draining into a temporary Vec first.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@rust/lance-index/src/scalar/bitmap.rs` at line 894, Remove the intermediate
Vec allocation in the ScalarValue::iter_to_array call by passing
self.keys.drain(..) directly, preserving the existing behavior.

Source: Coding guidelines

@wjones127
wjones127 merged commit 1946a5a into lance-format:main Jul 10, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer A-index Vector index, linalg, tokenizer A-namespace Namespace impls chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants