Skip to content

Core, Parquet: Carry avg value sizes for v4 content stats - #17451

Open
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:geo-avg-value-size-manifest
Open

Core, Parquet: Carry avg value sizes for v4 content stats#17451
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:geo-avg-value-size-manifest

Conversation

@huan233usc

@huan233usc huan233usc commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #17333.

#17333 collects the average serialized WKB size in FieldMetrics, but ParquetMetrics discarded it while assembling Metrics, so the value could never reach a DataFile or the v4 content_stats adapters. This PR closes that gap, carrying per-field average non-null value sizes through Metrics, ContentFile, the file builders, copies, and filtering, and exposing them through the legacy ContentFile view that v4 manifest readers use.

The v1-v3 manifest schemas are unchanged, so v3 manifests do not persist this optional metric. The v4 write-direction wrapper in #16936 can consume ContentFile.avgValueSizes() after rebasing.

ContentFile.avgValueSizes() is a default method returning null. Adding an abstract method to ContentFile would break the public API and ABI (RevAPI reports java.method.addedToInterface), and implementations that carry no column stats, such as the deletion-vector adapter, correctly inherit null. Metrics also keeps its unpinned serialVersionUID: no type holds a Metrics field, so it is only ever serialized and deserialized within a single version, and no cross-version shim is needed.

Tests:

  • ./gradlew :iceberg-api:test --tests org.apache.iceberg.TestMetricsSerialization
  • ./gradlew :iceberg-core:test --tests org.apache.iceberg.TestContentStatsBackedMap --tests org.apache.iceberg.TestTrackedFileAdapters
  • ./gradlew :iceberg-data:test --tests org.apache.iceberg.parquet.TestParquetMetrics.testMetricsForGeospatialTypes
  • ./gradlew :iceberg-parquet:test --tests org.apache.iceberg.parquet.TestParquetDataWriter.testGeospatialRoundTrip
  • ./gradlew :iceberg-api:revapi :iceberg-core:revapi :iceberg-parquet:revapi

@github-actions github-actions Bot added API spark parquet core Specification Issues that may introduce spec changes. labels Jul 31, 2026
@huan233usc
huan233usc marked this pull request as draft July 31, 2026 14:54
@huan233usc
huan233usc force-pushed the geo-avg-value-size-manifest branch from 018c802 to 4bdbfaf Compare July 31, 2026 17:45
@huan233usc huan233usc changed the title Core, Parquet: Carry avg value sizes for v4 content stats [WIP]Core, Parquet: Carry avg value sizes for v4 content stats Jul 31, 2026
@huan233usc
huan233usc force-pushed the geo-avg-value-size-manifest branch from 4bdbfaf to 0b172a2 Compare August 19, 2026 18:32
@huan233usc huan233usc changed the title [WIP]Core, Parquet: Carry avg value sizes for v4 content stats Core, Parquet: Carry avg value sizes for v4 content stats Aug 19, 2026
@huan233usc
huan233usc force-pushed the geo-avg-value-size-manifest branch 2 times, most recently from adf31b5 to 8e3e2a1 Compare August 20, 2026 02:09
Propagate average non-null value sizes from Parquet metrics through Metrics and
ContentFile so v4 content stats adapters can preserve them.

The v1-v3 manifest schemas are unchanged, so v3 manifests do not persist this
optional metric. No cross-version Java-serialization shim is added: no type
holds a Metrics field, so Metrics is only ever serialized and deserialized
within a single version.
@huan233usc
huan233usc force-pushed the geo-avg-value-size-manifest branch from 8e3e2a1 to f139886 Compare August 20, 2026 04:10
@huan233usc
huan233usc marked this pull request as ready for review August 20, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API core parquet spark Specification Issues that may introduce spec changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant