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

   ### Describe the issue this Pull Request addresses
   
   closes #19636
   
   ### Summary and Changelog
   
   A nullable ordering (precombine) field produces a null ordering value that 
flows into the file group reader merge path and throws `NullPointerException` 
in `BufferedRecordMergerFactory.shouldKeepNewerRecord` when `compareTo` is 
called (for example during a partition-path update index merge).
   
   - `OrderingValues.create` now coerces a null field value to `DEFAULT_VALUE` 
(`HoodieRecord.DEFAULT_ORDERING_VALUE`) across all three overloads, so it never 
returns null.
   - `shouldKeepNewerRecord` guards the comparison with `isDefault` + 
`isSameClass` before calling `compareTo`, mirroring the existing guard in 
`deltaMergeDeleteRecord`. This avoids a follow-on `ClassCastException` when the 
coerced default (`Integer 0`) is compared against a real `Long` ordering value.
   - `EventTimePartialRecordMerger.finalMerge` gets the same guard, since it 
has its own unguarded `compareTo` reached when `hoodie.partial.update.mode` is 
set.
   
   Added `TestOrderingValues` and two regression tests in 
`TestBufferedRecordMerger` covering the null and type-mismatch cases for both 
the event-time and partial-update mergers.
   
   ### Impact
   
   No public API change. A null ordering field value is now treated as the 
default ordering value (record kept as a tie) instead of crashing the 
read/merge.
   
   ### Risk Level
   
   low
   
   The guard only changes behavior for null or type-mismatched ordering values, 
which previously threw. Same-type, non-default comparisons are unchanged. 
Covered by new unit and functional tests.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] Adequate tests were added if applicable
   


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