hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasan...@apache.org
Subject hive git commit: HIVE-12815: column stats NPE for a query w/o a table (Prasanth Jayachandran reviewed by Sergey Shelukhin)
Date Wed, 13 Jan 2016 21:03:13 GMT
Repository: hive
Updated Branches:
  refs/heads/master ab1f405d1 -> b219752df


HIVE-12815: column stats NPE for a query w/o a table (Prasanth Jayachandran reviewed by Sergey
Shelukhin)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b219752d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b219752d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b219752d

Branch: refs/heads/master
Commit: b219752dfd12de862e9d9ce637e60720f3ab1b44
Parents: ab1f405
Author: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Authored: Thu Jan 14 02:31:52 2016 +0530
Committer: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Committed: Thu Jan 14 02:32:22 2016 +0530

----------------------------------------------------------------------
 .../apache/hadoop/hive/ql/stats/StatsUtils.java |  2 +-
 .../clientpositive/annotate_stats_table.q       |  3 +
 .../clientpositive/annotate_stats_table.q.out   | 99 ++++++++++++++++++++
 3 files changed, 103 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b219752d/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 2f78fe8..b4cf58f 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
@@ -1443,7 +1443,7 @@ public class StatsUtils {
   public static long getDataSizeFromColumnStats(long numRows, List<ColStatistics> colStats)
{
     long result = 0;
 
-    if (numRows <= 0) {
+    if (numRows <= 0 || colStats == null || colStats.isEmpty()) {
       return result;
     }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/b219752d/ql/src/test/queries/clientpositive/annotate_stats_table.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/annotate_stats_table.q b/ql/src/test/queries/clientpositive/annotate_stats_table.q
index ea1999f..b5389ff 100644
--- a/ql/src/test/queries/clientpositive/annotate_stats_table.q
+++ b/ql/src/test/queries/clientpositive/annotate_stats_table.q
@@ -51,3 +51,6 @@ explain select deptid from emp_orc;
 
 -- basicStatState: COMPLETE colStatState: COMPLETE
 explain select lastname,deptid from emp_orc;
+
+create table tmp as select 1;
+explain create table tmp as select 1;

http://git-wip-us.apache.org/repos/asf/hive/blob/b219752d/ql/src/test/results/clientpositive/annotate_stats_table.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/annotate_stats_table.q.out b/ql/src/test/results/clientpositive/annotate_stats_table.q.out
index 0f80755..cec3a1f 100644
--- a/ql/src/test/results/clientpositive/annotate_stats_table.q.out
+++ b/ql/src/test/results/clientpositive/annotate_stats_table.q.out
@@ -289,3 +289,102 @@ STAGE PLANS:
             Statistics: Num rows: 48 Data size: 4560 Basic stats: COMPLETE Column stats:
COMPLETE
             ListSink
 
+PREHOOK: query: create table tmp as select 1
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: database:default
+PREHOOK: Output: default@tmp
+POSTHOOK: query: create table tmp as select 1
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@tmp
+PREHOOK: query: explain create table tmp as select 1
+PREHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: query: explain create table tmp as select 1
+POSTHOOK: type: CREATETABLE_AS_SELECT
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-6 depends on stages: Stage-1 , consists of Stage-3, Stage-2, Stage-4
+  Stage-3
+  Stage-0 depends on stages: Stage-3, Stage-2, Stage-5
+  Stage-7 depends on stages: Stage-0
+  Stage-2
+  Stage-4
+  Stage-5 depends on stages: Stage-4
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: _dummy_table
+            Row Limit Per Split: 1
+            Statistics: Num rows: 1 Data size: 1 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: 1 (type: int)
+              outputColumnNames: _col0
+              Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats:
COMPLETE
+                table:
+                    input format: org.apache.hadoop.mapred.TextInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    name: default.tmp
+
+  Stage: Stage-6
+    Conditional Operator
+
+  Stage: Stage-3
+    Move Operator
+      files:
+          hdfs directory: true
+#### A masked pattern was here ####
+
+  Stage: Stage-0
+    Move Operator
+      files:
+          hdfs directory: true
+#### A masked pattern was here ####
+
+  Stage: Stage-7
+      Create Table Operator:
+        Create Table
+          columns: _c0 int
+          input format: org.apache.hadoop.mapred.TextInputFormat
+          output format: org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat
+          serde name: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+          name: default.tmp
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  name: default.tmp
+
+  Stage: Stage-4
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  name: default.tmp
+
+  Stage: Stage-5
+    Move Operator
+      files:
+          hdfs directory: true
+#### A masked pattern was here ####
+


Mime
View raw message