codope commented on code in PR #12953:
URL: https://github.com/apache/hudi/pull/12953#discussion_r2005829562
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -2628,11 +2621,42 @@ public static HoodieData<HoodieRecord>
convertMetadataToPartitionStatRecords(Hoo
: Option.of(new Schema.Parser().parse(writerSchemaStr)));
HoodieTableConfig tableConfig = dataMetaClient.getTableConfig();
Option<Schema> tableSchema = writerSchema.map(schema ->
tableConfig.populateMetaFields() ? addMetadataFields(schema) : schema);
+ if (tableSchema.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
Lazy<Option<Schema>> writerSchemaOpt = Lazy.eagerly(tableSchema);
Map<String, Schema> columnsToIndexSchemaMap =
getColumnsToIndex(dataMetaClient.getTableConfig(), metadataConfig,
writerSchemaOpt, false, recordTypeOpt);
if (columnsToIndexSchemaMap.isEmpty()) {
return engineContext.emptyHoodieData();
}
+
+ // if this is DELETE_PARTITION, then create delete metadata payload for
all columns for partition_stats
+ if (isDeletePartition) {
+ HoodieReplaceCommitMetadata replaceCommitMetadata =
(HoodieReplaceCommitMetadata) commitMetadata;
+ Map<String, List<String>> partitionToReplaceFileIds =
replaceCommitMetadata.getPartitionToReplaceFileIds();
+ List<String> partitionsToDelete = new
ArrayList<>(partitionToReplaceFileIds.keySet());
+ if (partitionToReplaceFileIds.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+ return engineContext.parallelize(partitionsToDelete,
partitionsToDelete.size()).flatMap(partition -> {
+ Stream<HoodieRecord> columnRangeMetadata =
columnsToIndexSchemaMap.keySet().stream()
+ .flatMap(column ->
HoodieMetadataPayload.createPartitionStatsRecords(
Review Comment:
No, partition stats are only aggregated for columns for which we have
colstats. The columns to index for colstats and partition stats go hand in
hand. This was changed in 1.0.1
--
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]