hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcama...@apache.org
Subject [hive] 02/02: HIVE-21444: Additional tests for materialized view rewriting (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)
Date Sat, 16 Mar 2019 03:18:45 GMT
This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git

commit 8d4300a02691777fc96f33861ed27e64fed72f2c
Author: Jesus Camacho Rodriguez <jcamacho@apache.org>
AuthorDate: Wed Mar 13 13:31:43 2019 -0700

    HIVE-21444: Additional tests for materialized view rewriting (Jesus Camacho Rodriguez,
reviewed by Ashutosh Chauhan)
---
 .../clientpositive/materialized_view_rewrite_1.q   |  38 ++++
 .../llap/materialized_view_rewrite_1.q.out         | 252 +++++++++++++++++++++
 2 files changed, 290 insertions(+)

diff --git a/ql/src/test/queries/clientpositive/materialized_view_rewrite_1.q b/ql/src/test/queries/clientpositive/materialized_view_rewrite_1.q
index ff7cefc..fc69cfd 100644
--- a/ql/src/test/queries/clientpositive/materialized_view_rewrite_1.q
+++ b/ql/src/test/queries/clientpositive/materialized_view_rewrite_1.q
@@ -167,3 +167,41 @@ select name from emps_n3 group by name;
 select name from emps_n3 group by name;
 
 drop materialized view mv1_n2;
+
+-- NEW 1
+create materialized view mv1_n2 as
+select deptno, name, count(*) as c
+from depts_n2
+group by deptno, name;
+
+explain
+select name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by name;
+
+select name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by name;
+
+drop materialized view mv1_n2;
+
+-- NEW 2
+create materialized view mv1_n2 as
+select deptno, name, locationid, count(*) as c
+from depts_n2
+group by deptno, name, locationid;
+
+explain
+select deptno, name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by deptno, name;
+
+select deptno, name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by deptno, name;
+
+drop materialized view mv1_n2;
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out
index b9af487..d8aab03 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_1.q.out
@@ -1019,3 +1019,255 @@ POSTHOOK: query: drop materialized view mv1_n2
 POSTHOOK: type: DROP_MATERIALIZED_VIEW
 POSTHOOK: Input: default@mv1_n2
 POSTHOOK: Output: default@mv1_n2
+PREHOOK: query: create materialized view mv1_n2 as
+select deptno, name, count(*) as c
+from depts_n2
+group by deptno, name
+PREHOOK: type: CREATE_MATERIALIZED_VIEW
+PREHOOK: Input: default@depts_n2
+PREHOOK: Output: database:default
+PREHOOK: Output: default@mv1_n2
+POSTHOOK: query: create materialized view mv1_n2 as
+select deptno, name, count(*) as c
+from depts_n2
+group by deptno, name
+POSTHOOK: type: CREATE_MATERIALIZED_VIEW
+POSTHOOK: Input: default@depts_n2
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@mv1_n2
+PREHOOK: query: explain
+select name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@depts_n2
+PREHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+POSTHOOK: query: explain
+select name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@depts_n2
+POSTHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: default.mv1_n2
+                  filterExpr: (CAST( name AS STRING) = 'Sales') (type: boolean)
+                  Statistics: Num rows: 3 Data size: 291 Basic stats: COMPLETE Column stats:
COMPLETE
+                  Filter Operator
+                    predicate: (CAST( name AS STRING) = 'Sales') (type: boolean)
+                    Statistics: Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats:
COMPLETE
+                    Select Operator
+                      expressions: c (type: bigint)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 97 Basic stats: COMPLETE Column
stats: COMPLETE
+                      Group By Operator
+                        aggregations: sum(_col0)
+                        keys: true (type: boolean)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0, _col1
+                        Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column
stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: boolean)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: boolean)
+                          Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column
stats: COMPLETE
+                          value expressions: _col1 (type: bigint)
+            Execution mode: vectorized, llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: vectorized, llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: boolean)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats:
COMPLETE
+                Select Operator
+                  expressions: 'Sales' (type: varchar(256)), COALESCE(_col1,0) (type: bigint)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats:
COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats:
COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@depts_n2
+PREHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+POSTHOOK: query: select name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@depts_n2
+POSTHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+Sales	1
+PREHOOK: query: drop materialized view mv1_n2
+PREHOOK: type: DROP_MATERIALIZED_VIEW
+PREHOOK: Input: default@mv1_n2
+PREHOOK: Output: default@mv1_n2
+POSTHOOK: query: drop materialized view mv1_n2
+POSTHOOK: type: DROP_MATERIALIZED_VIEW
+POSTHOOK: Input: default@mv1_n2
+POSTHOOK: Output: default@mv1_n2
+PREHOOK: query: create materialized view mv1_n2 as
+select deptno, name, locationid, count(*) as c
+from depts_n2
+group by deptno, name, locationid
+PREHOOK: type: CREATE_MATERIALIZED_VIEW
+PREHOOK: Input: default@depts_n2
+PREHOOK: Output: database:default
+PREHOOK: Output: default@mv1_n2
+POSTHOOK: query: create materialized view mv1_n2 as
+select deptno, name, locationid, count(*) as c
+from depts_n2
+group by deptno, name, locationid
+POSTHOOK: type: CREATE_MATERIALIZED_VIEW
+POSTHOOK: Input: default@depts_n2
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@mv1_n2
+PREHOOK: query: explain
+select deptno, name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by deptno, name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@depts_n2
+PREHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+POSTHOOK: query: explain
+select deptno, name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by deptno, name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@depts_n2
+POSTHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: default.mv1_n2
+                  filterExpr: (CAST( name AS STRING) = 'Sales') (type: boolean)
+                  Statistics: Num rows: 3 Data size: 303 Basic stats: COMPLETE Column stats:
COMPLETE
+                  Filter Operator
+                    predicate: (CAST( name AS STRING) = 'Sales') (type: boolean)
+                    Statistics: Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats:
COMPLETE
+                    Select Operator
+                      expressions: deptno (type: int), c (type: bigint)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 1 Data size: 101 Basic stats: COMPLETE Column
stats: COMPLETE
+                      Group By Operator
+                        aggregations: sum(_col1)
+                        keys: _col0 (type: int)
+                        minReductionHashAggr: 0.0
+                        mode: hash
+                        outputColumnNames: _col0, _col1
+                        Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column
stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: int)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: int)
+                          Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column
stats: COMPLETE
+                          value expressions: _col1 (type: bigint)
+            Execution mode: vectorized, llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: vectorized, llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: int)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats:
COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), 'Sales' (type: varchar(256)), COALESCE(_col1,0)
(type: bigint)
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats:
COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats:
COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select deptno, name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by deptno, name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@depts_n2
+PREHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+POSTHOOK: query: select deptno, name, count(*) as c
+from depts_n2
+where name = 'Sales'
+group by deptno, name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@depts_n2
+POSTHOOK: Input: default@mv1_n2
+#### A masked pattern was here ####
+10	Sales	1
+PREHOOK: query: drop materialized view mv1_n2
+PREHOOK: type: DROP_MATERIALIZED_VIEW
+PREHOOK: Input: default@mv1_n2
+PREHOOK: Output: default@mv1_n2
+POSTHOOK: query: drop materialized view mv1_n2
+POSTHOOK: type: DROP_MATERIALIZED_VIEW
+POSTHOOK: Input: default@mv1_n2
+POSTHOOK: Output: default@mv1_n2


Mime
View raw message