You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "dengzhhu653 (via GitHub)" <gi...@apache.org> on 2026/10/12 08:29:59 UTC
[PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
dengzhhu653 opened a new pull request, #6865:
URL: https://github.com/apache/hive/pull/6865
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
3. Ensure you have added or run the appropriate tests for your PR:
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX: Your PR title ...'.
5. Be sure to keep the PR description updated to reflect all changes.
6. Please write your PR title to summarize what this PR proposes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducible example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 merged PR #6865:
URL: https://github.com/apache/hive/pull/6865
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on PR #6865:
URL: https://github.com/apache/hive/pull/6865#issuecomment-6205468545
Thanks for the review! @DanielZhu58 @saihemanth-cloudera
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "dengzhhu653 (via GitHub)" <gi...@apache.org>.
dengzhhu653 commented on code in PR #6865:
URL: https://github.com/apache/hive/pull/6865#discussion_r4289659449
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskDedupColumns.java:
##########
@@ -110,6 +110,9 @@ private void printSummary(MetaToolObjectStore.DedupColumnsResult result, boolean
+ result.getStorageDescriptorsUpdated());
if (!isDryRun) {
System.out.println("Column descriptors removed: " + result.getColumnDescriptorsRemoved());
+ if (result.getTablesValidated() > 0) {
+ System.out.println("Post-commit validation passed for " + result.getTablesValidated() + " table(s).");
Review Comment:
this is the new feature that hasn't been released yet, so the user shouldn't aware of the changes
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6865:
URL: https://github.com/apache/hive/pull/6865#issuecomment-6135715462
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6865) **Quality Gate passed**
Issues
 [6 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6865&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6865&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6865&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6865&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6865&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6865)
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6865:
URL: https://github.com/apache/hive/pull/6865#discussion_r4253226743
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/ColumnDeduplicator.java:
##########
@@ -278,7 +299,87 @@ private Map<Long, List<FieldSchema>> loadColumnSchemas(Set<Long> cdIds) {
return result;
}
- private static Map<List<FieldSchema>, List<Long>> groupByColumnSchema(Map<Long, List<FieldSchema>> cdColumns) {
+ private List<PartitionSchemaSnapshot> capturePartitionSchemas(List<Map.Entry<PartitionSdInfo, Long>> updates) {
+ List<PartitionSchemaSnapshot> snapshots = new ArrayList<>(updates.size());
+ for (Map.Entry<PartitionSdInfo, Long> update: updates) {
+ PartitionSdInfo psi = update.getKey();
+ snapshots.add(new PartitionSchemaSnapshot(
+ psi.partId,
+ convertToFieldSchemas(psi.sd.getCD().getCols())));
Review Comment:
The validation snapshot records only the pre-update schema, not the canonical CD ID from `update.getValue()`. If an SD remap is not persisted, the partition still exposes the same schema through its old duplicate CD, so this check passes and `tablesValidated` is incremented even though de-duplication did not occur. Record the expected canonical CD ID in each snapshot and compare it with the reloaded `partition.cdId` in addition to comparing schemas.
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/ColumnDeduplicator.java:
##########
@@ -93,6 +96,16 @@ MetaToolObjectStore.DedupColumnsResult run(String catalogFilter, String dbFilter
}
}
}
+
+ try {
+ if (committed && validation != null) {
+ validateTableAfterDedup(table, validation.schemaSnapshots());
+ result.incrementTablesValidated();
+ }
+ } catch (MetaException e) {
+ result.catchException(new IllegalStateException("Failed to validate the column deduplication for this table: " + table, e));
Review Comment:
The validation query can throw unchecked JDO/database exceptions, but this catches only `MetaException`. Such failures escape `run()`, bypass `DedupColumnsResult`, and prevent `MetaToolTaskDedupColumns` from printing the result summary and its normal wrapped failure. Catch `Exception` here, as the mutation phase already does, so every validation failure follows the same result contract.
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskDedupColumns.java:
##########
@@ -110,6 +110,9 @@ private void printSummary(MetaToolObjectStore.DedupColumnsResult result, boolean
+ result.getStorageDescriptorsUpdated());
if (!isDryRun) {
System.out.println("Column descriptors removed: " + result.getColumnDescriptorsRemoved());
+ if (result.getTablesValidated() > 0) {
+ System.out.println("Post-commit validation passed for " + result.getTablesValidated() + " table(s).");
+ }
Review Comment:
This adds observable CLI output for live runs, while the PR description says the change has no user-facing impact. Please update the PR's user-facing-change section to mention the new validation summary (and the updated command help) so release reviewers and users are not given conflicting information.
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/ColumnDeduplicator.java:
##########
@@ -278,7 +299,87 @@ private Map<Long, List<FieldSchema>> loadColumnSchemas(Set<Long> cdIds) {
return result;
}
- private static Map<List<FieldSchema>, List<Long>> groupByColumnSchema(Map<Long, List<FieldSchema>> cdColumns) {
+ private List<PartitionSchemaSnapshot> capturePartitionSchemas(List<Map.Entry<PartitionSdInfo, Long>> updates) {
+ List<PartitionSchemaSnapshot> snapshots = new ArrayList<>(updates.size());
+ for (Map.Entry<PartitionSdInfo, Long> update: updates) {
+ PartitionSdInfo psi = update.getKey();
+ snapshots.add(new PartitionSchemaSnapshot(
+ psi.partId,
+ convertToFieldSchemas(psi.sd.getCD().getCols())));
+ }
+ return snapshots;
+ }
+
+ public void validateTableAfterDedup(TableInfo table, List<PartitionSchemaSnapshot> before)
+ throws MetaException {
+ List<PartitionSdInfo> partitions =
+ loadPartitionCdRefs(before.stream().map(b -> b.partitionId).toList());
Review Comment:
This sends every updated partition ID in one JDO collection query. Large partitioned tables can exceed backend/generated-query limits after the de-duplication transaction has already committed, causing the command to report a validation failure for a successful mutation. Please batch this reload with `Batchable.runBatched` using the raw-store JDO batch setting; `MetastoreConf.RAWSTORE_PARTITION_BATCH_SIZE` explicitly exists for generated JDO queries that become too large (MetastoreConf.java:1826-1830), and analogous ID-list reads are batched in `DirectSqlUpdatePart.java:670-687`.
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6865:
URL: https://github.com/apache/hive/pull/6865#issuecomment-6143645379
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6865) **Quality Gate passed**
Issues
 [6 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6865&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6865&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6865&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6865&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6865&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6865)
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #6865:
URL: https://github.com/apache/hive/pull/6865#issuecomment-6122860173
## [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6865) **Quality Gate passed**
Issues
 [6 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6865&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=6865&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=6865&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6865&metric=new_coverage&view=list)
 [1.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=6865&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=6865)
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6865:
URL: https://github.com/apache/hive/pull/6865#discussion_r4254801699
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/ColumnDeduplicator.java:
##########
@@ -106,57 +119,53 @@ MetaToolObjectStore.DedupColumnsResult run(String catalogFilter, String dbFilter
return result;
}
- private void deduplicateTable(TableInfo table, MetaToolObjectStore.DedupColumnsResult result) {
+ private PostCommitValidation deduplicateTable(TableInfo table, MetaToolObjectStore.DedupColumnsResult result)
+ throws MetaException {
List<PartitionSdInfo> partitionSds = loadPartitionStorageDescriptors(table.tableId);
if (partitionSds.isEmpty()) {
- return;
+ return null;
}
Set<Long> cdIds = partitionSds.stream().map(p -> p.cdId).collect(Collectors.toSet());
cdIds.add(table.tableCdId);
-
- Map<Long, List<FieldSchema>> cdColumns = loadColumnSchemas(cdIds);
- Map<List<FieldSchema>, List<Long>> groups = groupByColumnSchema(cdColumns);
+ Map<List<FieldSchema>, Set<Long>> groups = groupByColumnSchema(cdIds);
Map<Long, Long> cdRemap = new HashMap<>();
- for (List<Long> group : groups.values()) {
+ for (Set<Long> group : groups.values()) {
if (group.size() <= 1) {
continue;
}
- long canonicalCdId = pickCanonicalCdId(new HashSet<>(group), table.tableCdId, partitionSds);
+ long canonicalCdId = pickCanonicalCdId(group, table.tableCdId, partitionSds);
for (long cdId : group) {
if (cdId != canonicalCdId) {
cdRemap.put(cdId, canonicalCdId);
}
}
}
- if (cdRemap.isEmpty()) {
- return;
- }
-
List<Map.Entry<PartitionSdInfo, Long>> partSdUpdates = buildPartitionUpdates(partitionSds, cdRemap);
if (partSdUpdates.isEmpty()) {
- return;
+ return null;
}
-
result.incrementTablesWithDuplicates();
for (Map.Entry<PartitionSdInfo, Long> update : partSdUpdates) {
result.incrementStorageDescriptorsUpdated();
if (isVerbose) {
PartitionSdInfo partSd = update.getKey();
long newCdId = update.getValue();
- result.addDetail(String.format("table %s.%s.%s: SD %s CD %d -> %d",
- table.catalogName, table.dbName, table.tableName,
- JDOHelper.getObjectId(partSd.sd), partSd.cdId, newCdId));
+ result.addDetail(String.format("table %s.%s.%s: CD %d -> %d",
+ table.catalogName, table.dbName, table.tableName, partSd.cdId, newCdId));
Review Comment:
The `-verbose` option is documented as printing per-partition details, but removing the SD identifier leaves no partition identifier here; multiple partitions with the same remap now produce indistinguishable lines. Include the newly available partition ID in each detail.
This issue also appears in the following locations of the same file:
- line 353
- line 423
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
Re: [PR] HIVE-30100: Post-run integrity checks for metatool column de-duplication [hive]
Posted by "saihemanth-cloudera (via GitHub)" <gi...@apache.org>.
saihemanth-cloudera commented on code in PR #6865:
URL: https://github.com/apache/hive/pull/6865#discussion_r4289522785
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/MetaToolTaskDedupColumns.java:
##########
@@ -110,6 +110,9 @@ private void printSummary(MetaToolObjectStore.DedupColumnsResult result, boolean
+ result.getStorageDescriptorsUpdated());
if (!isDryRun) {
System.out.println("Column descriptors removed: " + result.getColumnDescriptorsRemoved());
+ if (result.getTablesValidated() > 0) {
+ System.out.println("Post-commit validation passed for " + result.getTablesValidated() + " table(s).");
Review Comment:
nit: this adds visible CLI output, so the “user-facing change” section should probably mention it?
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org