You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "codope (via GitHub)" <gi...@apache.org> on 2025/03/11 07:30:02 UTC
[PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
codope opened a new pull request, #12953:
URL: https://github.com/apache/hudi/pull/12953
### Change Logs
Partition stats entry for deleted partitions were not removed. This could cause incorrect query results (incorrect partition pruning). This patch simply marks such entries as deleted and adds a test to validate the index.
### Impact
Fix partition stats index consistency.
### Risk level (write none, low medium or high below)
low
### Documentation Update
_Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none"._
- _The config description must be updated if new configs are added or the default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
changes to the website._
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12953:
URL: https://github.com/apache/hudi/pull/12953#issuecomment-2714385579
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "129174939ff78933a17421004c511381d352caa1",
"status" : "DELETED",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143",
"triggerID" : "129174939ff78933a17421004c511381d352caa1",
"triggerType" : "PUSH"
}, {
"hash" : "3d7baabb9205e2c79c0f8804808fa039afcc45bc",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4149",
"triggerID" : "3d7baabb9205e2c79c0f8804808fa039afcc45bc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3d7baabb9205e2c79c0f8804808fa039afcc45bc Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4149)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "yihua (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12953:
URL: https://github.com/apache/hudi/pull/12953#issuecomment-2712977843
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "129174939ff78933a17421004c511381d352caa1",
"status" : "PENDING",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143",
"triggerID" : "129174939ff78933a17421004c511381d352caa1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 129174939ff78933a17421004c511381d352caa1 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "yihua (via GitHub)" <gi...@apache.org>.
yihua merged PR #12953:
URL: https://github.com/apache/hudi/pull/12953
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #12953:
URL: https://github.com/apache/hudi/pull/12953#discussion_r1993611357
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -410,8 +411,9 @@ public static Map<String, HoodieData<HoodieRecord>> convertMetadataToRecords(Hoo
checkState(MetadataPartitionType.COLUMN_STATS.isMetadataPartitionAvailable(dataMetaClient),
"Column stats partition must be enabled to generate partition stats. Please enable: " + HoodieMetadataConfig.ENABLE_METADATA_INDEX_COLUMN_STATS.key());
// Generate Hoodie Pair data of partition name and list of column range metadata for all the files in that partition
+ boolean isDeletePartition = commitMetadata.getOperationType().equals(WriteOperationType.DELETE_PARTITION);
Review Comment:
Agree, created HUDI-8714 as followup. I think we can land this PR as files and partition stats are used in partition pruning so these indexes need to be strongly consistent. Column stats can be eventually consistent (update when replaced filegroups are cleaned) as colstats is used in data skipping after partition pruning.
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12953:
URL: https://github.com/apache/hudi/pull/12953#issuecomment-2712972411
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "129174939ff78933a17421004c511381d352caa1",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "129174939ff78933a17421004c511381d352caa1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 129174939ff78933a17421004c511381d352caa1 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12953:
URL: https://github.com/apache/hudi/pull/12953#issuecomment-2713182296
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "129174939ff78933a17421004c511381d352caa1",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143",
"triggerID" : "129174939ff78933a17421004c511381d352caa1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 129174939ff78933a17421004c511381d352caa1 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "yihua (via GitHub)" <gi...@apache.org>.
yihua commented on code in PR #12953:
URL: https://github.com/apache/hudi/pull/12953#discussion_r1990324655
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -410,8 +411,9 @@ public static Map<String, HoodieData<HoodieRecord>> convertMetadataToRecords(Hoo
checkState(MetadataPartitionType.COLUMN_STATS.isMetadataPartitionAvailable(dataMetaClient),
"Column stats partition must be enabled to generate partition stats. Please enable: " + HoodieMetadataConfig.ENABLE_METADATA_INDEX_COLUMN_STATS.key());
// Generate Hoodie Pair data of partition name and list of column range metadata for all the files in that partition
+ boolean isDeletePartition = commitMetadata.getOperationType().equals(WriteOperationType.DELETE_PARTITION);
Review Comment:
As a follow-up, should we consider making this check general and make other index types also consider the `DELETE_PARTITION` write operation in a distinct way?
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12953:
URL: https://github.com/apache/hudi/pull/12953#issuecomment-2714004963
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "129174939ff78933a17421004c511381d352caa1",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143",
"triggerID" : "129174939ff78933a17421004c511381d352caa1",
"triggerType" : "PUSH"
}, {
"hash" : "3d7baabb9205e2c79c0f8804808fa039afcc45bc",
"status" : "PENDING",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4149",
"triggerID" : "3d7baabb9205e2c79c0f8804808fa039afcc45bc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 129174939ff78933a17421004c511381d352caa1 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143)
* 3d7baabb9205e2c79c0f8804808fa039afcc45bc Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4149)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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
Re: [PR] [HUDI-8345] Delete partition stats index for a partition that is deleted [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #12953:
URL: https://github.com/apache/hudi/pull/12953#issuecomment-2714000296
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "129174939ff78933a17421004c511381d352caa1",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143",
"triggerID" : "129174939ff78933a17421004c511381d352caa1",
"triggerType" : "PUSH"
}, {
"hash" : "3d7baabb9205e2c79c0f8804808fa039afcc45bc",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3d7baabb9205e2c79c0f8804808fa039afcc45bc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 129174939ff78933a17421004c511381d352caa1 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=4143)
* 3d7baabb9205e2c79c0f8804808fa039afcc45bc UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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