suhyeon729 opened a new pull request, #19163:
URL: https://github.com/apache/iceberg/pull/19163

   Related to #19142 (see also #6669)
   
   `SizeBasedFileRewritePlanner.enoughContent` selects any group with more than 
one file whose total size is above the target size. If 
`expectedOutputFiles(inputSize)` is not smaller than the number of input files, 
rewriting the group writes the same number of files again. When those files are 
still below `min-file-size-bytes`, every run selects and rewrites them again, 
so the table never converges.
   
   For example, with target=100, min=75, max=180 and two files of size 60, the 
group total is 120, but `expectedOutputFiles(120)` is 2 (the remainder is below 
min, and distributing it would exceed 1.1 * target), so two files of ~60 are 
written again.
   
   This requires `expectedOutputFiles(inputSize(group)) < group.size()` in 
`enoughContent`, so a group is only selected if rewriting it can reduce the 
file count.
   
   Test plan:
   - Added `testGroupNotRewrittenWhenFileCountDoesNotDecrease` (60 + 60 is not 
planned, fails without this change) and 
`testGroupRewrittenWhenFileCountDecreases` (52 + 52 is planned) in 
`TestBinPackRewriteFilePlanner`.
   - Ran `org.apache.iceberg.actions.*` in core, Spark 4.2 
`TestRewriteDataFilesAction` and `TestRewritePositionDeleteFilesAction`, Flink 
1.20 `TestDataFileRewritePlanner` and `TestDataFileRewriteRunner`, plus 
`spotlessCheck` and checkstyle for core. All pass.
   
   Opened as a draft to get maintainers' view on the direction (guard group 
selection vs. adjust the output sizing policy). Not covered: `enoughInputFiles` 
(an explicit `min-input-files=2` still selects the same group), partition spec 
evolution, and a dedicated position-delete test. Only the planner behavior was 
verified, not repeated physical rewrites end to end.
   
   AI disclosure: this change, its tests and this description were drafted with 
Claude Code. I reviewed the logic and ran the tests listed above.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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