yihua commented on code in PR #12953:
URL: https://github.com/apache/hudi/pull/12953#discussion_r1999677812
##########
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:
@codope sth to revisit: is there a chance that the columns for deletion
`columnsToIndexSchemaMap` can be different from the storage (i.e., the
partition stats contain more columns than specified in the table config)?
--
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]