hudi-agent commented on code in PR #19126:
URL: https://github.com/apache/hudi/pull/19126#discussion_r3502918424
##########
hudi-common/src/test/java/org/apache/hudi/avro/TestAvroRecordContext.java:
##########
@@ -94,11 +97,53 @@ void testGetFieldValueNested() {
@Test
void testGetFieldValueErrorCases() {
GenericRecord record = buildRecord();
- // a union that is not [null, T] does not support field lookups
- assertThrows(IllegalStateException.class, () ->
getFieldValueFromIndexedRecord(record, "multi.sub"));
+ // a union that is not [null, T] cannot be navigated into; instead of
throwing, the value
+ // navigator returns null so callers (e.g. column-stats collection)
degrade gracefully,
+ // matching HoodieAvroUtils.getNestedFieldVal
+ assertNull(getFieldValueFromIndexedRecord(record, "multi.sub"));
+ // an empty field name is still rejected up front
assertThrows(IllegalArgumentException.class, () ->
getFieldValueFromIndexedRecord(record, ""));
}
+ private static final Schema COMPLEX_SCHEMA = new Schema.Parser().parse(
Review Comment:
🤖 nit: `COMPLEX_SCHEMA` is a bit ambiguous — "complex" could mean Avro
complex types, or just a complicated schema. Something like
`MAP_AND_ARRAY_SCHEMA` would immediately signal what's being covered here and
make the constant self-documenting when a future test author scans for it.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]