HIVE-29617: Unable to load column statistics of Iceberg table after upgrading Hive#6491
Open
kasakrisz wants to merge 1 commit into
Open
HIVE-29617: Unable to load column statistics of Iceberg table after upgrading Hive#6491kasakrisz wants to merge 1 commit into
kasakrisz wants to merge 1 commit into
Conversation
deniskuzZ
reviewed
May 15, 2026
|
|
||
| Set<String> neededCols = new HashSet<>(neededColumns); | ||
| Set<String> colsWithStats = new HashSet<>(); | ||
| List<ColStatistics> neededColStats = new ArrayList<>(neededCols.size()); |
Member
There was a problem hiding this comment.
can we simplify?
private static List<ColStatistics> estimateStatsForMissingCols(
List<String> neededColumns, List<ColStatistics> existingColStats,
HiveConf conf, long nr, List<ColumnInfo> schema) {
Set<String> missingCols = new HashSet<>(neededColumns);
List<ColStatistics> neededColStats = new ArrayList<>(neededColumns.size());
for (ColStatistics cs : existingColStats) {
if (missingCols.remove(cs.getColumnName())) {
neededColStats.add(cs);
}
}
if (!missingCols.isEmpty()) {
neededColStats.addAll(estimateStats(schema, new ArrayList<>(missingCols), conf, nr));
}
return neededColStats;
}
deniskuzZ
reviewed
May 15, 2026
| import java.io.Serial; | ||
| import java.io.Serializable; | ||
|
|
||
| public record HiveColumnStatisticsObj( |
Member
There was a problem hiding this comment.
This looks like a major refactor and that would be ok if iceberg community accepted it. But it seems they are moving with a diff approach for v4, please take a look: apache/iceberg#14234
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What changes were proposed in this pull request?
StatsUtils.estimateStatsForMissingColsto return a new list of column statistics instead of adding the newly estimated stats to its input parameter.Why are the changes needed?
serialVersionUIDis not explicitly specified, hence the Java compiler generates one at build time. This can lead to compatibility issues when a newer Hive version attempts to read column stats from a table created by an older version.Collections.emptyList()is returned. Because this is an unmodifiable list, the current implementation ofestimateStatsForMissingColstries to add the estimated column statistics to it and an exception is thrown.Does this PR introduce any user-facing change?
No.
How was this patch tested?