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

   ## Problem
   
   `BaseFile.splitOffsets()` and `equalityFieldIds()` each wrap their internal 
`long[]` / `int[]` in a new unmodifiable `List` via `ArrayUtil` on every 
invocation. During manifest reading and rewriting, these methods are called for 
every entry in every manifest file, making each call an unnecessary allocation 
that is immediately consumed and discarded.
   
   Noticed while reading through the manifest hot path. Related: #15622.
   
   ## Fix
   
   Cache both list wrappers as `transient` fields (matching the existing 
`avroSchema` caching pattern already in the class). The caches are cleared in 
`put()` (cases 14 and 15) so the Avro `reuseContainers` path -- which calls 
`put()` on the same `BaseFile` object for each new record -- always sees fresh 
data from the current entry.
   
   ## Testing
   
   - `testDataFileSplitOffsetsCachedAcrossCalls`: verifies the same list 
instance is returned on repeated calls
   - `testDataFileSplitOffsetsCacheInvalidatedOnPut`: directly calls `put(14, 
...)` to simulate the `reuseContainers` path and verifies the cache is cleared 
so subsequent calls return the new offsets


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