diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java index 1ac5aff..0af5058 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java @@ -198,16 +198,11 @@ public static boolean updateUnpartitionedTableStatsFast(Table tbl, // Let's try to populate those stats that don't require full scan. LOG.info("Updating table stats fast for " + tbl.getTableName()); populateQuickStats(fileStatus, params); - LOG.info("Updated size of table " + tbl.getTableName() +" to "+ params.get(StatsSetupConst.TOTAL_SIZE)); - if(!params.containsKey(StatsSetupConst.STATS_GENERATED_VIA_STATS_TASK)) { - // invalidate stats requiring scan since this is a regular ddl alter case - for (String stat : StatsSetupConst.statsRequireCompute) { - params.put(stat, "-1"); - } - params.put(StatsSetupConst.COLUMN_STATS_ACCURATE, StatsSetupConst.FALSE); - } else { - params.remove(StatsSetupConst.STATS_GENERATED_VIA_STATS_TASK); + LOG.info("Updated size of table " + tbl.getTableName() + " to " + params.get(StatsSetupConst.TOTAL_SIZE)); + if (params.containsKey(StatsSetupConst.STATS_GENERATED_VIA_STATS_TASK)) { params.put(StatsSetupConst.COLUMN_STATS_ACCURATE, StatsSetupConst.TRUE); + } else { + params.put(StatsSetupConst.COLUMN_STATS_ACCURATE, StatsSetupConst.FALSE); } } tbl.setParameters(params); @@ -320,15 +315,10 @@ public static boolean updatePartitionStatsFast(PartitionSpecProxy.PartitionItera FileStatus[] fileStatus = wh.getFileStatusesForLocation(part.getLocation()); populateQuickStats(fileStatus, params); LOG.warn("Updated size to " + params.get(StatsSetupConst.TOTAL_SIZE)); - if(!params.containsKey(StatsSetupConst.STATS_GENERATED_VIA_STATS_TASK)) { - // invalidate stats requiring scan since this is a regular ddl alter case - for (String stat : StatsSetupConst.statsRequireCompute) { - params.put(stat, "-1"); - } - params.put(StatsSetupConst.COLUMN_STATS_ACCURATE, StatsSetupConst.FALSE); - } else { - params.remove(StatsSetupConst.STATS_GENERATED_VIA_STATS_TASK); + if (params.containsKey(StatsSetupConst.STATS_GENERATED_VIA_STATS_TASK)) { params.put(StatsSetupConst.COLUMN_STATS_ACCURATE, StatsSetupConst.TRUE); + } else { + params.put(StatsSetupConst.COLUMN_STATS_ACCURATE, StatsSetupConst.FALSE); } } part.setParameters(params);