adiranjan25 commented on PR #19163:
URL: https://github.com/apache/iceberg/pull/19163#issuecomment-7333946169

   Thanks @suhyeon729 for the detailed Spark/Flink investigation and for 
following up on the `min-input-files=2` finding.
   
   The new results clarify an important distinction: `expectedOutputFiles()` 
estimates the number of files based on total bytes, but that estimate does not 
necessarily match the number of executable Spark read tasks or resulting output 
files, particularly when Parquet files have a single row group.
   
   Based on the results, my preference would be **Option 1 as a focused initial 
fix**, with the eligibility check implemented specifically for Spark bin-pack 
rather than in the shared `SizeBasedFileRewritePlanner`.
   
   My reasoning:
   
   1. **Correctness and scope:** The immediate issue is repeated, nonproductive 
rewrites. A Spark-specific guard appears to address the measured cases without 
imposing Spark's split-packing constraints on Flink, sort/z-order, or 
position-delete planning.
   2. **Preserving legitimate rewrites:** The guard should not automatically 
reject groups requiring partition-spec evolution, oversized-file handling, or 
delete-related processing solely because their file count may remain unchanged.
   3. **Avoiding false decisions:** The eligibility calculation should use the 
runner's actual split-packing behavior, rather than treating 
`expectedOutputFiles()` as a guarantee of physical output count. The 
interaction with `max-files-to-rewrite` also needs explicit coverage.
   4. **Regression risk:** Option 1 may skip groups that currently rewrite once 
and converge without reducing file count. That behavior change should be 
documented and tested before merging.
   
   Option 2 is worth investigating as a follow-up because it could preserve 
more compaction opportunities. However, the proposed larger split sizes need 
end-to-end validation, including writer rollover and small-tail-file behavior.
   
   I would also favor **removing or narrowing the current shared-core guard** 
once the Spark-specific direction is agreed, rather than merging it as a 
general convergence fix.
   
   I'm happy to contribute the additional regression coverage, including:
   
   - Repeated physical rewrites across three consecutive Spark actions.
   - Single-row-group versus multiple-row-group Parquet inputs.
   - The 2 × 0.60T, 3 × 0.55T, 3 × 0.667T, and 5 × 0.52T cases.
   - Explicit `min-input-files` and `max-files-to-rewrite`.
   - Partition-spec evolution and delete-related rewrite behavior.
   - Cases where compaction legitimately reduces the file count.
   
   My earlier planner-level A/B tests and position-delete compatibility tests 
are available in the branches linked above. I would keep those as 
characterization coverage and add the end-to-end tests once we have an agreed 
implementation direction.
   
   @suhyeon729, if this direction is acceptable to the maintainers, I'm happy 
to take responsibility for the focused Spark regression tests while you work on 
the implementation, so we can avoid duplicating effort.
   
   Thanks again for the collaboration.


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