Anurag-S1ngh opened a new pull request, #19274:
URL: https://github.com/apache/iceberg/pull/19274

   ## Summary
   
   - `RewriteManifests` copies each data file's stats verbatim, so tightening 
`write.metadata.metrics.*` never shrinks existing manifests. The excess stats 
stay until every data file is rewritten.
   - Add a `pruneColumnStats()` option to the `RewriteManifests` API. When 
enabled, rewritten data files drop the stats that exceed the table's current 
metrics configuration.
   
   ## Changes
   
   - `RewriteManifests`: add `pruneColumnStats()` as a default method that 
throws `UnsupportedOperationException` for other implementations.
   - `MetricsUtil.pruneColumnStats`: drop all stats for `none` columns, drop 
bounds for `counts` columns, keep stats for `truncate`/`full` columns, and 
leave stats for fields that are not in the schema untouched. Existing bounds 
are never re-truncated.
   - `BaseRewriteManifests`: apply pruning to rewritten entries. When no 
`clusterBy` function is set, enabling pruning triggers a full rewrite so all 
data files are regrouped.
   - `TestMetricsUtil`: cover per-column modes, fields missing from the schema, 
and no re-truncation.
   - `TestRewriteManifests`: cover a rewritten manifest and a full rewrite 
without `clusterBy`.
   
   ## Testing
   
   - `./gradlew :iceberg-core:test --tests "org.apache.iceberg.TestMetricsUtil" 
--tests "org.apache.iceberg.TestRewriteManifests"` passes.
   - The two new rewrite tests use stats that would remain without the change, 
and the full rewrite test confirms the no-cluster case rewrites all manifests.
   - `spotlessApply` run for the API and core modules.
   
   Closes #17257
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to