siddiqueirshad opened a new pull request, #20461:
URL: https://github.com/apache/hudi/pull/20461

   ### Change Logs
   In `HoodieBackedTableMetadata.lookupIndexRecords`, partition-scoped RLI 
lookups (`dataTablePartition.isPresent()`) previously filtered file slices by 
data partition, and then immediately evaluated 
`distinctSortedKeys.stream().findFirst().get()` and called 
`mapRecordKeyToFileGroupIndex(..., fileSlicesForDataPartition.size())`.
   - When querying an empty partition (or one with no RLI file slices), 
`fileSlicesForDataPartition.size()` was 0, resulting in division by zero and an 
`ArithmeticException`.
   - When querying with an empty key collection, `distinctSortedKeys` was 
empty, resulting in `NoSuchElementException`.
   
   This PR adds an early return check returning 
`HoodieListData.lazy(Collections.emptyList())` when 
`fileSlicesForDataPartition.isEmpty() || keys.isEmpty()`, preventing exceptions 
and returning empty results as expected.
   
   Fixes #20435.
   
   ### Impact
   Prevents `ArithmeticException` and `NoSuchElementException` on point lookups 
when querying empty partitions or empty key collections in partitioned record 
index.
   
   ### Risk level
   none
   
   ### Contributor Checklist
   - [x] Commits are signed off (`git commit -s`)
   - [x] Verified fix against edge cases
   


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

Reply via email to