hcrosse opened a new pull request, #2784:
URL: https://github.com/apache/iceberg-go/pull/2784

   
[`Config.Validate`](https://github.com/apache/iceberg-go/blob/main/table/compaction/compaction.go#L146)
 did not validate `PackingLookback`. A `Config` struct literal that omits 
`PackingLookback` passes validation with lookback `0`, which 
[`PlanCompaction`](https://github.com/apache/iceberg-go/blob/main/table/compaction/compaction.go#L307)
 passes to 
[`PackingIterator`](https://github.com/apache/iceberg-go/blob/main/internal/utils.go#L201).
 Because `len(bins) > 0` holds after inserting the first item into a new bin, 
the iterator immediately evicts every candidate into its own bin of length 1. 
When `MinInputFiles` is at least 2, every candidate is silently dropped into 
`SkippedFiles` and `PlanCompaction` returns zero groups. Values above 
`math.MaxInt` also wrap negative on the `int(cfg.PackingLookback)` conversion 
with the same result.
   
   This change rejects `PackingLookback == 0` and `PackingLookback > 
math.MaxInt` in `Config.Validate`, matching how `TargetFileSizeBytes`, 
`MaxFileSizeBytes`, and `DeleteFileThreshold` reject invalid zero values 
instead of defaulting them.
   
   ### Changes
   
   - Reject `PackingLookback == 0` and `PackingLookback > math.MaxInt` in 
`Config.Validate`, and note the minimum value of 1 on `Config.PackingLookback`.
   - Add validation and `PlanCompaction` tests covering lookback `0`, 
`math.MaxInt + 1`, and `1`, and set `DefaultPackingLookback` on the existing 
invalid config cases in `TestConfig_Validate` so each case isolates one field.
   


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