linliu-code opened a new pull request, #19915:
URL: https://github.com/apache/hudi/pull/19915

   ### Describe the issue this Pull Request addresses
   
   part of #19901, same family as #19899 and #19908
   
   ### Summary and Changelog
   
   `HoodieStreamerUtils` computed a record's ordering value only when 
`shouldCombine` was true. That
   flag answers whether the incoming batch needs de-duplicating, which is a 
different question from
   whether a record needs an ordering value: it is false for `INSERT` and 
`BULK_INSERT`.
   
   Those records still reach a merge. `getInsertPartitioner` delegates to 
`getUpsertPartitioner`, and
   `UpsertPartitioner` packs inserts into existing small files as 
`BucketType.UPDATE`, so they go
   through a merge handle where `BufferedRecordMergerFactory` compares their 
ordering value against
   the base record's. A payload class outside `DEPRECATED_PAYLOADS` takes the 
`HoodieAvroRecord`
   branch of `HoodieRecordUtils#createHoodieRecord` regardless of 
`requiresPayload`, and that record
   serves the payload's `Integer` default rather than the ordering field's 
value.
   
   This is the same gate as #19908, on the Hudi Streamer path rather than the 
Spark SQL one. Kept
   separate so each path's reachability argument stands on its own.
   
   ### Impact
   
   On a table that orders by event time, ingesting with `--op INSERT` and a 
custom payload class
   produced records whose ordering value was `Integer` 0. Compared against a 
base record's `Long`
   that throws `ClassCastException`; on an `int` ordering column it silently 
keeps the stored record.
   Commit time ordered tables and delete semantics are unchanged. No public API 
change.
   
   ### Risk Level
   
   low
   
   The new branch is taken only when the table declares ordering fields, the 
merge mode is not
   `COMMIT_TIME_ORDERING`, and the record is not a delete, and it then performs 
the extraction the
   `shouldCombine` branch beside it already performed.
   `TestHoodieStreamerUtils#testInsertWithCustomPayloadCarriesTheOrderingValue` 
fails against master
   with `Unexpected type, expected: <java.lang.Long> but was: 
<java.lang.Integer>`.
   
   ### Documentation Update
   
   None. No new config, no default value change, no user facing feature change.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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