You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2018/08/18 04:51:51 UTC

hive git commit: HIVE-20406 : Nested Coalesce giving incorrect results (Vineet Garg via Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master 468907eab -> e57b52b4c


HIVE-20406 : Nested Coalesce giving incorrect results (Vineet Garg via Ashutosh Chauhan)

Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


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

Branch: refs/heads/master
Commit: e57b52b4c19f0f07124e8188569f61246b345676
Parents: 468907e
Author: Vineet Garg <vg...@apache.org>
Authored: Fri Aug 17 21:51:17 2018 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Fri Aug 17 21:51:17 2018 -0700

----------------------------------------------------------------------
 itests/src/test/resources/testconfiguration.properties |  1 +
 ql/src/test/queries/clientpositive/udf_coalesce.q      |  2 ++
 ql/src/test/results/clientpositive/udf_coalesce.q.out  | 13 +++++++++----
 .../primitive/JavaVoidObjectInspector.java             |  3 +--
 4 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e57b52b4/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index 27d2974..af7f089 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -741,6 +741,7 @@ minillaplocal.query.files=\
   uber_reduce.q,\
   udaf_collect_set_2.q,\
   udaf_all_keyword.q,\
+  udf_coalesce.q,\
   union_fast_stats.q,\
   union_rowcounts.q,\
   union_remove_26.q,\

http://git-wip-us.apache.org/repos/asf/hive/blob/e57b52b4/ql/src/test/queries/clientpositive/udf_coalesce.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_coalesce.q b/ql/src/test/queries/clientpositive/udf_coalesce.q
index 7248efe..7d87580 100644
--- a/ql/src/test/queries/clientpositive/udf_coalesce.q
+++ b/ql/src/test/queries/clientpositive/udf_coalesce.q
@@ -56,3 +56,5 @@ SELECT COALESCE(src_thrift.lint[1], 999),
        COALESCE(src_thrift.lintstring[0].mystring, '999'),
        COALESCE(src_thrift.mstringstring['key_2'], '999')
 FROM src_thrift;
+
+SELECT COALESCE(COALESCE(null), 'TEST');

http://git-wip-us.apache.org/repos/asf/hive/blob/e57b52b4/ql/src/test/results/clientpositive/udf_coalesce.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_coalesce.q.out b/ql/src/test/results/clientpositive/udf_coalesce.q.out
index ef57f83..48e9e32 100644
--- a/ql/src/test/results/clientpositive/udf_coalesce.q.out
+++ b/ql/src/test/results/clientpositive/udf_coalesce.q.out
@@ -66,11 +66,9 @@ STAGE PLANS:
         TableScan
           alias: src
           Row Limit Per Split: 1
-          Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
             expressions: 1 (type: int), 1 (type: int), 2 (type: int), 1 (type: int), 3 (type: int), 4 (type: int), '1' (type: string), '1' (type: string), '2' (type: string), '1' (type: string), '3' (type: string), '4' (type: string), 1 (type: decimal(1,0)), 1 (type: decimal(1,0)), 2 (type: decimal(1,0)), 2 (type: decimal(1,0)), 2 (type: decimal(1,0)), null (type: int)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
-            Statistics: Num rows: 500 Data size: 547004 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink
 
 PREHOOK: query: SELECT COALESCE(1),
@@ -140,11 +138,9 @@ STAGE PLANS:
       Processor Tree:
         TableScan
           alias: src_thrift
-          Statistics: Num rows: 11 Data size: 30700 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: COALESCE(lint[1],999) (type: int), COALESCE(lintstring[0].mystring,'999') (type: string), COALESCE(mstringstring['key_2'],'999') (type: string)
             outputColumnNames: _col0, _col1, _col2
-            Statistics: Num rows: 11 Data size: 30700 Basic stats: COMPLETE Column stats: NONE
             ListSink
 
 PREHOOK: query: SELECT COALESCE(src_thrift.lint[1], 999),
@@ -172,3 +168,12 @@ POSTHOOK: Input: default@src_thrift
 16	512	999
 18	729	999
 999	999	999
+PREHOOK: query: SELECT COALESCE(COALESCE(null), 'TEST')
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT COALESCE(COALESCE(null), 'TEST')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+TEST

http://git-wip-us.apache.org/repos/asf/hive/blob/e57b52b4/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaVoidObjectInspector.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaVoidObjectInspector.java b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaVoidObjectInspector.java
index 2273bfb..8ef07f4 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaVoidObjectInspector.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaVoidObjectInspector.java
@@ -32,7 +32,6 @@ public class JavaVoidObjectInspector extends
 
   @Override
   public Object getPrimitiveWritableObject(Object o) {
-    return NullWritable.get();
+    return o == null ? null : NullWritable.get();
   }
-
 }