linliu-code commented on code in PR #9623:
URL: https://github.com/apache/hudi/pull/9623#discussion_r1317970066
##########
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:
Thanks. I will update it later.
--
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]