codope commented on code in PR #9623:
URL: https://github.com/apache/hudi/pull/9623#discussion_r1316605069
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -198,23 +195,26 @@ class ColumnStats {
targetFields.forEach(field -> {
ColumnStats colStats = allColumnStats.computeIfAbsent(field.name(),
(ignored) -> new ColumnStats());
- GenericRecord genericRecord = (GenericRecord) record;
-
- final Object fieldVal =
convertValueForSpecificDataTypes(field.schema(),
genericRecord.get(field.name()), false);
- final Schema fieldSchema =
getNestedFieldSchemaFromWriteSchema(genericRecord.getSchema(), field.name());
+ Schema fieldSchema = getNestedFieldSchemaFromWriteSchema(recordSchema,
field.name());
+ Object fieldValue;
+ if (record.getRecordType() == HoodieRecordType.AVRO) {
+ fieldValue = HoodieAvroUtils.getRecordColumnValues(record, new
String[]{field.name()}, recordSchema, false)[0];
+ } else if (record.getRecordType() == HoodieRecordType.SPARK) {
+ fieldValue = record.getColumnValues(recordSchema, new
String[]{field.name()}, false)[0];
+ } else {
+ throw new HoodieException(String.format("Unknown record type: %s",
record.getRecordType()));
Review Comment:
minor: earlier we used to String.format. But, now we do `throw new
HoodieException("Unknown record type: {}", record.getRecordType())`
--
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]