You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "linliu-code (via GitHub)" <gi...@apache.org> on 2023/09/07 01:13:49 UTC
[GitHub] [hudi] linliu-code commented on a diff in pull request #9623: [HUDI-5249] Support column metadata stats index for Spark
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org