You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ct...@apache.org on 2015/09/30 18:15:36 UTC
hive git commit: HIVE-11964: RelOptHiveTable.hiveColStatsMap might
contain mismatched column stats (Chaoyu Tang,
reviewed by Laljo John Pullokkaran)
Repository: hive
Updated Branches:
refs/heads/master 1cb307336 -> 1f0878939
HIVE-11964: RelOptHiveTable.hiveColStatsMap might contain mismatched column stats (Chaoyu Tang, reviewed by Laljo John Pullokkaran)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1f087893
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1f087893
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1f087893
Branch: refs/heads/master
Commit: 1f08789395db979c1ca298fbaf7a46abfb7d4e1f
Parents: 1cb3073
Author: ctang <ct...@gmail.com>
Authored: Wed Sep 30 12:15:16 2015 -0400
Committer: ctang <ct...@gmail.com>
Committed: Wed Sep 30 12:15:16 2015 -0400
----------------------------------------------------------------------
.../hive/ql/optimizer/calcite/RelOptHiveTable.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/1f087893/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java
index 6c0bd25..1bd241b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java
@@ -312,6 +312,19 @@ public class RelOptHiveTable extends RelOptAbstractTable {
setOfFiledCols.removeAll(setOfObtainedColStats);
colNamesFailedStats.addAll(setOfFiledCols);
+ } else {
+ // Column stats in hiveColStats might not be in the same order as the columns in
+ // nonPartColNamesThatRqrStats. reorder hiveColStats so we can build hiveColStatsMap
+ // using nonPartColIndxsThatRqrStats as below
+ Map<String, ColStatistics> columnStatsMap =
+ new HashMap<String, ColStatistics>(hiveColStats.size());
+ for (ColStatistics cs : hiveColStats) {
+ columnStatsMap.put(cs.getColumnName(), cs);
+ }
+ hiveColStats.clear();
+ for (String colName : nonPartColNamesThatRqrStats) {
+ hiveColStats.add(columnStatsMap.get(colName));
+ }
}
} else {
// 2.2 Obtain col stats for partitioned table.
@@ -349,6 +362,8 @@ public class RelOptHiveTable extends RelOptAbstractTable {
if (hiveColStats != null && hiveColStats.size() == nonPartColNamesThatRqrStats.size()) {
for (int i = 0; i < hiveColStats.size(); i++) {
+ // the columns in nonPartColIndxsThatRqrStats/nonPartColNamesThatRqrStats/hiveColStats
+ // are in same order
hiveColStatsMap.put(nonPartColIndxsThatRqrStats.get(i), hiveColStats.get(i));
}
}