You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by rb...@apache.org on 2019/01/16 09:08:00 UTC

hive git commit: HIVE-21104: PTF with nested structure throws ClassCastException (Rajesh Balamohan reviewed by Gopal V

Repository: hive
Updated Branches:
  refs/heads/master a3aa074d7 -> fd3498b33


HIVE-21104: PTF with nested structure throws ClassCastException (Rajesh Balamohan reviewed by Gopal V


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

Branch: refs/heads/master
Commit: fd3498b33ab95ad163728759a88afa945b4a9010
Parents: a3aa074
Author: Rajesh Balamohan <rb...@apache.org>
Authored: Wed Jan 16 14:37:26 2019 +0530
Committer: Rajesh Balamohan <rb...@apache.org>
Committed: Wed Jan 16 14:37:26 2019 +0530

----------------------------------------------------------------------
 .../hive/ql/udf/ptf/WindowingTableFunction.java |  2 ++
 ql/src/test/queries/clientpositive/windowing.q  |  6 ++++
 .../results/clientpositive/llap/windowing.q.out | 31 ++++++++++++++++++++
 .../clientpositive/spark/windowing.q.out        | 31 ++++++++++++++++++++
 4 files changed, 70 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/fd3498b3/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
index 5f9009c..827e50f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
@@ -388,6 +388,8 @@ public class WindowingTableFunction extends TableFunctionEvaluator {
     }
 
     streamingState.rollingPart.append(row);
+    //Get back converted row
+    row = streamingState.rollingPart.getAt(streamingState.rollingPart.size() -1);
 
     WindowTableFunctionDef tabDef = (WindowTableFunctionDef) tableDef;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/fd3498b3/ql/src/test/queries/clientpositive/windowing.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/windowing.q b/ql/src/test/queries/clientpositive/windowing.q
index 76f8fce..07f599e 100644
--- a/ql/src/test/queries/clientpositive/windowing.q
+++ b/ql/src/test/queries/clientpositive/windowing.q
@@ -442,3 +442,9 @@ where p_mfgr='Manufacturer#1';
 -- 47. empty partition
 select sum(p_size) over (partition by p_mfgr )
 from part where p_mfgr = 'm1';
+
+-- 48. nested tables (HIVE-21104)
+DROP TABLE IF EXISTS struct_table_example;
+CREATE TABLE struct_table_example (a int, s1 struct<f1: boolean, f2: string, f3: int, f4: int> ) STORED AS ORC;
+INSERT INTO TABLE struct_table_example SELECT 1, named_struct('f1', false, 'f2', 'test', 'f3', 3, 'f4', 4)  FROM part limit 1;
+select s1.f1, s1.f2, rank() over (partition by s1.f2 order by s1.f4) from struct_table_example;

http://git-wip-us.apache.org/repos/asf/hive/blob/fd3498b3/ql/src/test/results/clientpositive/llap/windowing.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/windowing.q.out b/ql/src/test/results/clientpositive/llap/windowing.q.out
index ffd21ab..37e9470 100644
--- a/ql/src/test/results/clientpositive/llap/windowing.q.out
+++ b/ql/src/test/results/clientpositive/llap/windowing.q.out
@@ -2350,3 +2350,34 @@ from part where p_mfgr = 'm1'
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@part
 #### A masked pattern was here ####
+PREHOOK: query: DROP TABLE IF EXISTS struct_table_example
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS struct_table_example
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE struct_table_example (a int, s1 struct<f1: boolean, f2: string, f3: int, f4: int> ) STORED AS ORC
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@struct_table_example
+POSTHOOK: query: CREATE TABLE struct_table_example (a int, s1 struct<f1: boolean, f2: string, f3: int, f4: int> ) STORED AS ORC
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@struct_table_example
+PREHOOK: query: INSERT INTO TABLE struct_table_example SELECT 1, named_struct('f1', false, 'f2', 'test', 'f3', 3, 'f4', 4)  FROM part limit 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+PREHOOK: Output: default@struct_table_example
+POSTHOOK: query: INSERT INTO TABLE struct_table_example SELECT 1, named_struct('f1', false, 'f2', 'test', 'f3', 3, 'f4', 4)  FROM part limit 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+POSTHOOK: Output: default@struct_table_example
+POSTHOOK: Lineage: struct_table_example.a SIMPLE []
+POSTHOOK: Lineage: struct_table_example.s1 EXPRESSION []
+PREHOOK: query: select s1.f1, s1.f2, rank() over (partition by s1.f2 order by s1.f4) from struct_table_example
+PREHOOK: type: QUERY
+PREHOOK: Input: default@struct_table_example
+#### A masked pattern was here ####
+POSTHOOK: query: select s1.f1, s1.f2, rank() over (partition by s1.f2 order by s1.f4) from struct_table_example
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@struct_table_example
+#### A masked pattern was here ####
+false	test	1

http://git-wip-us.apache.org/repos/asf/hive/blob/fd3498b3/ql/src/test/results/clientpositive/spark/windowing.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/windowing.q.out b/ql/src/test/results/clientpositive/spark/windowing.q.out
index be458f1..5c2cce7 100644
--- a/ql/src/test/results/clientpositive/spark/windowing.q.out
+++ b/ql/src/test/results/clientpositive/spark/windowing.q.out
@@ -2347,3 +2347,34 @@ from part where p_mfgr = 'm1'
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@part
 #### A masked pattern was here ####
+PREHOOK: query: DROP TABLE IF EXISTS struct_table_example
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS struct_table_example
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE struct_table_example (a int, s1 struct<f1: boolean, f2: string, f3: int, f4: int> ) STORED AS ORC
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@struct_table_example
+POSTHOOK: query: CREATE TABLE struct_table_example (a int, s1 struct<f1: boolean, f2: string, f3: int, f4: int> ) STORED AS ORC
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@struct_table_example
+PREHOOK: query: INSERT INTO TABLE struct_table_example SELECT 1, named_struct('f1', false, 'f2', 'test', 'f3', 3, 'f4', 4)  FROM part limit 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+PREHOOK: Output: default@struct_table_example
+POSTHOOK: query: INSERT INTO TABLE struct_table_example SELECT 1, named_struct('f1', false, 'f2', 'test', 'f3', 3, 'f4', 4)  FROM part limit 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+POSTHOOK: Output: default@struct_table_example
+POSTHOOK: Lineage: struct_table_example.a SIMPLE []
+POSTHOOK: Lineage: struct_table_example.s1 EXPRESSION []
+PREHOOK: query: select s1.f1, s1.f2, rank() over (partition by s1.f2 order by s1.f4) from struct_table_example
+PREHOOK: type: QUERY
+PREHOOK: Input: default@struct_table_example
+#### A masked pattern was here ####
+POSTHOOK: query: select s1.f1, s1.f2, rank() over (partition by s1.f2 order by s1.f4) from struct_table_example
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@struct_table_example
+#### A masked pattern was here ####
+false	test	1