Skip to content

feat(java): expose index segment sizes - #8355

Merged
Xuanwo merged 1 commit into
lance-format:mainfrom
majin1102:agent/java-index-segment-stats
Aug 7, 2026
Merged

feat(java): expose index segment sizes#8355
Xuanwo merged 1 commit into
lance-format:mainfrom
majin1102:agent/java-index-segment-stats

Conversation

@majin1102

Copy link
Copy Markdown
Contributor

Summary

  • expose per-segment index file size through Index#getSizeBytes()
  • expose aggregate logical-index size through IndexDescription#getTotalSizeBytes()
  • preserve Optional.empty() for indices created before file-size tracking and retain the existing public constructor

Why

Rust and Python already expose persisted index file-size metadata, while Java drops it at the JNI boundary. Java engines therefore cannot inspect physical segment sizes when planning index maintenance, including the size-tiered work tracked in lance-spark#744.

Validation

  • ./mvnw -Dtest=DatasetTest#testDescribeIndicesByName test
  • ./mvnw spotless:check
  • cargo clippy --target-dir target/rust-maven-plugin/lance-jni --tests --manifest-path ./lance-jni/Cargo.toml -- -D warnings

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

This closes the Java binding gap at the existing metadata boundary: per-segment sizes remain attached to Index, aggregate size follows the Rust IndexDescription contract, and legacy unknown sizes stay optional. The thin JNI mapping is preferable to storage listing or a parallel UUID-to-size structure because it reuses metadata already loaded and avoids an extra source of truth.

@Xuanwo
Xuanwo merged commit 82c81ca into lance-format:main Aug 7, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants