linliu-code opened a new pull request, #19900: URL: https://github.com/apache/hudi/pull/19900
### Describe the issue this Pull Request addresses closes #19899 ### Summary and Changelog `HoodieAvroRecord.doGetOrderingValue` delegated unconditionally to the payload, and payloads built without an explicit ordering value default to `OrderingValues.getDefault()`, an `Integer`. Its sibling `HoodieAvroIndexedRecord` reads the ordering fields off the record in the same situation, so the two Avro record representations disagreed on the ordering value and on its type. This reads the ordering fields off the record when the payload yields the default. The fallback is deliberately narrow: an explicitly supplied ordering value still wins, deletes keep the default so `BufferedRecord.isCommitTimeOrderingDelete` keeps classifying them as commit time ordered, a nullable ordering field holding null keeps the default rather than returning null, and a record the payload cannot decode keeps the default rather than raising from an ordering value lookup. ### Impact Fixes a `ClassCastException` on every merged row for copy on write tables whose ordering column is not an `int`, reached through prepped Spark SQL writes among other paths. No public API change. ### Risk Level low The new behaviour is reached only when the payload reports the default ordering value, the table declares ordering fields, and the record is not a delete, and it then performs the same extraction `HoodieAvroIndexedRecord` already performs. `TestHoodieAvroRecord` covers the regression plus the three behaviours that must not change. Against master the regression test fails with `Unexpected type, expected: <java.lang.Long> but was: <java.lang.Integer>`, and the three guards fail against a fallback that omits them. ### 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 -- 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]
