yihua opened a new pull request, #19839:
URL: https://github.com/apache/hudi/pull/19839
### Describe the issue this Pull Request addresses
issue: #19838
Adds the regression test only. The behavior fix is deliberately not
included, so the test is added disabled.
### Summary and Changelog
A record whose ordering field value is null is accepted into the write
instead of being routed to the error table as a `RECORD_CREATION` failure. The
existing `TestHoodieStreamerUtils` never entered the ordering-value path at
all, because it configures no ordering field, so the gap was uncovered.
Adds `testCreateHoodieRecordsWithNullOrderingValue` to
`TestHoodieStreamerUtils`, parameterized over both record-creation paths and
selected through `hoodie.write.merge.handle.class`: the default
`FileGroupReaderBasedMergeHandle` for the file-group-reader path, and
`HoodieMergeHandle` for the payload path. It asserts the record is absent from
the output and present in the error table as a `RECORD_CREATION` event, with
the full expected payload rather than a count.
The test is `@Disabled` because it asserts the intended behavior and both
paths currently fail it. Enabling it belongs with the change that makes record
creation reject a null ordering value.
Verified on this base with the annotation removed: both parameters fail with
```
expected: <[]> but was: <[HoodieRecord{key=HoodieKey(recordKey=key1,
partitionPath=path1), currentLocation='null', newLocation='null'}]>
```
and with a reject-on-null added at record creation, both pass. The expected
error-table payload was measured rather than assumed: a schema-valid record is
serialized by `HoodieAvroUtils.safeAvroToJsonString` through the Avro
`JsonEncoder`, which wraps nullable union values. The pre-existing
`testCreateHoodieRecordsWithError` asserts an unwrapped payload only because
its record is schema-invalid, so serialization throws and falls back to
`record.toString()`.
### Impact
None. Test-only, and the added test is disabled.
### Risk Level
none
### Documentation Update
none
### 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]