diff --git ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java index ae51b4db51..b7adc485a7 100644 --- ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java +++ ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java @@ -128,7 +128,6 @@ /** * Collect table, partition and column level statistics - * Note: DOES NOT CHECK txn stats. * @param conf * - hive configuration * @param partList @@ -227,7 +226,6 @@ private static void estimateStatsForMissingCols(List neededColumns, List } } - /** Note: DOES NOT CHECK txn stats. */ public static Statistics collectStatistics(HiveConf conf, PrunedPartitionList partList, Table table, List schema, List neededColumns, ColumnStatsList colStatsCache, List referencedColumns, boolean fetchColStats) @@ -266,10 +264,7 @@ private static Statistics collectStatistics(HiveConf conf, PrunedPartitionList p long numErasureCodedFiles = getErasureCodedFiles(table); if (fetchColStats) { - // Note: this is currently called from two notable places (w/false for checkTxn) - // 1) StatsRulesProcFactory.TableScanStatsRule via collectStatistics - // 2) RelOptHiveTable via getColStats and updateColStats. - colStats = getTableColumnStats(table, schema, neededColumns, colStatsCache, false); + colStats = getTableColumnStats(table, schema, neededColumns, colStatsCache); if(colStats == null) { colStats = Lists.newArrayList(); } @@ -389,11 +384,8 @@ private static Statistics collectStatistics(HiveConf conf, PrunedPartitionList p // size is 0, aggrStats is null after several retries. Thus, we can // skip the step to connect to the metastore. if (neededColsToRetrieve.size() > 0 && partNames.size() > 0) { - // Note: this is currently called from two notable places (w/false for checkTxn) - // 1) StatsRulesProcFactory.TableScanStatsRule via collectStatistics - // 2) RelOptHiveTable via getColStats and updateColStats. aggrStats = Hive.get().getAggrColStatsFor(table.getDbName(), table.getTableName(), - neededColsToRetrieve, partNames, false); + neededColsToRetrieve, partNames, true); } boolean statsRetrieved = aggrStats != null && @@ -1004,7 +996,7 @@ else if(colTypeLowerCase.equals(serdeConstants.SMALLINT_TYPE_NAME)){ */ public static List getTableColumnStats( Table table, List schema, List neededColumns, - ColumnStatsList colStatsCache, boolean checkTransactional) { + ColumnStatsList colStatsCache) { if (table.isMaterializedTable()) { LOG.debug("Materialized table does not contain table statistics"); return null; @@ -1033,7 +1025,7 @@ else if(colTypeLowerCase.equals(serdeConstants.SMALLINT_TYPE_NAME)){ List stats = null; try { List colStat = Hive.get().getTableColumnStatistics( - dbName, tabName, colStatsToRetrieve, checkTransactional); + dbName, tabName, colStatsToRetrieve, true); stats = convertColStats(colStat, tabName); } catch (HiveException e) { LOG.error("Failed to retrieve table statistics: ", e);