Repository: hive Updated Branches: refs/heads/branch-3 b38bef33f -> fe3b15ee8
HIVE-19390 : Useless error messages logged for dummy table stats (Ashutosh Chauhan via Jesus Camacho Rodriguez) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/fe3b15ee Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/fe3b15ee Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/fe3b15ee Branch: refs/heads/branch-3 Commit: fe3b15ee833eb84de43fae1018ff476ab93a7881 Parents: b38bef3 Author: Ashutosh Chauhan <[email protected]> Authored: Wed May 2 17:32:00 2018 -0700 Committer: Vineet Garg <[email protected]> Committed: Thu May 24 21:44:52 2018 -0700 ---------------------------------------------------------------------- .../java/org/apache/hadoop/hive/ql/stats/StatsUtils.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/fe3b15ee/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java index cef87f5..952b4ab 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java @@ -59,6 +59,7 @@ import org.apache.hadoop.hive.ql.metadata.PartitionIterable; import org.apache.hadoop.hive.ql.metadata.Table; import org.apache.hadoop.hive.ql.parse.ColumnStatsList; import org.apache.hadoop.hive.ql.parse.PrunedPartitionList; +import org.apache.hadoop.hive.ql.parse.SemanticAnalyzer; import org.apache.hadoop.hive.ql.plan.ColStatistics; import org.apache.hadoop.hive.ql.plan.ColStatistics.Range; import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc; @@ -1054,8 +1055,8 @@ public class StatsUtils { cs.setAvgColLen(getAvgColLenOf(conf,cinfo.getObjectInspector(), cinfo.getTypeName())); } else if (colTypeLowerCase.equals(serdeConstants.BOOLEAN_TYPE_NAME)) { cs.setCountDistint(2); - cs.setNumTrues(Math.max(1, (long)numRows/2)); - cs.setNumFalses(Math.max(1, (long)numRows/2)); + cs.setNumTrues(Math.max(1, numRows/2)); + cs.setNumFalses(Math.max(1, numRows/2)); cs.setAvgColLen(JavaDataModel.get().primitive1()); } else if (colTypeLowerCase.equals(serdeConstants.TIMESTAMP_TYPE_NAME) || colTypeLowerCase.equals(serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME)) { @@ -1117,6 +1118,12 @@ public class StatsUtils { // Retrieve stats from metastore String dbName = table.getDbName(); String tabName = table.getTableName(); + if (SemanticAnalyzer.DUMMY_DATABASE.equals(dbName) && + SemanticAnalyzer.DUMMY_TABLE.equals(tabName)) { + // insert into values gets written into insert from select dummy_table + // This table is dummy and has no stats + return null; + } List<ColStatistics> stats = null; try { List<ColumnStatisticsObj> colStat = Hive.get().getTableColumnStatistics(
