http://git-wip-us.apache.org/repos/asf/hive/blob/c695c70b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_8.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_8.q.out 
b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_8.q.out
new file mode 100644
index 0000000..3dcbd55
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_8.q.out
@@ -0,0 +1,641 @@
+PREHOOK: query: create table if not exists source_table_001 (
+MY_DATE date,
+MY_ID bigint,
+MY_ID2 bigint,
+ENVIRONMENT string,
+DOWN_VOLUME bigint,
+UP_VOLUME bigint
+)
+stored AS ORC
+TBLPROPERTIES("transactional"="true")
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@source_table_001
+POSTHOOK: query: create table if not exists source_table_001 (
+MY_DATE date,
+MY_ID bigint,
+MY_ID2 bigint,
+ENVIRONMENT string,
+DOWN_VOLUME bigint,
+UP_VOLUME bigint
+)
+stored AS ORC
+TBLPROPERTIES("transactional"="true")
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@source_table_001
+PREHOOK: query: insert into table source_table_001
+  values ('2010-10-10', 1, 1, 'env', 1, 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@source_table_001
+POSTHOOK: query: insert into table source_table_001
+  values ('2010-10-10', 1, 1, 'env', 1, 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@source_table_001
+POSTHOOK: Lineage: source_table_001.down_volume SCRIPT []
+POSTHOOK: Lineage: source_table_001.environment SCRIPT []
+POSTHOOK: Lineage: source_table_001.my_date SCRIPT []
+POSTHOOK: Lineage: source_table_001.my_id SCRIPT []
+POSTHOOK: Lineage: source_table_001.my_id2 SCRIPT []
+POSTHOOK: Lineage: source_table_001.up_volume SCRIPT []
+PREHOOK: query: analyze table source_table_001 compute statistics for columns
+PREHOOK: type: QUERY
+PREHOOK: Input: default@source_table_001
+PREHOOK: Output: default@source_table_001
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table source_table_001 compute statistics for columns
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@source_table_001
+POSTHOOK: Output: default@source_table_001
+#### A masked pattern was here ####
+PREHOOK: query: CREATE MATERIALIZED VIEW source_table_001_mv ENABLE REWRITE AS
+SELECT
+SUM(A.DOWN_VOLUME) AS DOWN_VOLUME_SUM,
+SUM(A.UP_VOLUME) AS UP_VOLUME_SUM,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+from source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: CREATE_MATERIALIZED_VIEW
+PREHOOK: Input: default@source_table_001
+PREHOOK: Output: database:default
+PREHOOK: Output: default@source_table_001_mv
+POSTHOOK: query: CREATE MATERIALIZED VIEW source_table_001_mv ENABLE REWRITE AS
+SELECT
+SUM(A.DOWN_VOLUME) AS DOWN_VOLUME_SUM,
+SUM(A.UP_VOLUME) AS UP_VOLUME_SUM,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+from source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: CREATE_MATERIALIZED_VIEW
+POSTHOOK: Input: default@source_table_001
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@source_table_001_mv
+PREHOOK: query: analyze table source_table_001_mv compute statistics for 
columns
+PREHOOK: type: QUERY
+PREHOOK: Input: default@source_table_001_mv
+PREHOOK: Output: default@source_table_001_mv
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table source_table_001_mv compute statistics for 
columns
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@source_table_001_mv
+POSTHOOK: Output: default@source_table_001_mv
+#### A masked pattern was here ####
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Select Operator
+            expressions: down_volume_sum (type: bigint), my_date (type: date), 
my_id2 (type: bigint), environment (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            ListSink
+
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+LIMIT 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+LIMIT 100
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: 100
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Select Operator
+            expressions: down_volume_sum (type: bigint), my_date (type: date), 
my_id2 (type: bigint), environment (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Limit
+              Number of rows: 100
+              ListSink
+
+PREHOOK: query: explain
+select
+1,
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+1,
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Select Operator
+            expressions: 1 (type: int), down_volume_sum (type: bigint), 
my_date (type: date), my_id2 (type: bigint), environment (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4
+            ListSink
+
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) + 0 AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) + 0 AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Select Operator
+            expressions: (down_volume_sum + 0L) (type: bigint), my_date (type: 
date), my_id2 (type: bigint), environment (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            ListSink
+
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+ORDER BY A.MY_ID2 
+LIMIT 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+ORDER BY A.MY_ID2 
+LIMIT 100
+POSTHOOK: type: QUERY
+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.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 159 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Select Operator
+                    expressions: down_volume_sum (type: bigint), my_date 
(type: date), my_id2 (type: bigint), environment (type: string)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 1 Data size: 159 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col2 (type: bigint)
+                      sort order: +
+                      Statistics: Num rows: 1 Data size: 159 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+                      value expressions: _col0 (type: bigint), _col1 (type: 
date), _col3 (type: string)
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: bigint), VALUE._col1 (type: 
date), KEY.reducesinkkey0 (type: bigint), VALUE._col2 (type: string)
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 1 Data size: 159 Basic stats: COMPLETE 
Column stats: COMPLETE
+                Limit
+                  Number of rows: 100
+                  Statistics: Num rows: 1 Data size: 159 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 159 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: 100
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: explain
+select
+distinct A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+distinct A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+POSTHOOK: type: QUERY
+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.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Select Operator
+                    expressions: my_date (type: date), my_id2 (type: bigint), 
environment (type: string)
+                    outputColumnNames: my_date, my_id2, environment
+                    Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: my_date (type: date), my_id2 (type: bigint), 
environment (type: string)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: date), _col1 (type: 
bigint), _col2 (type: string)
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: date), 
_col1 (type: bigint), _col2 (type: string)
+                        Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: date), KEY._col1 (type: bigint), 
KEY._col2 (type: string)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 151 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: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Filter Operator
+            predicate: (my_date = DATE'2010-01-10') (type: boolean)
+            Select Operator
+              expressions: down_volume_sum (type: bigint), DATE'2010-01-10' 
(type: date), my_id2 (type: bigint), environment (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              ListSink
+
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) + SUM(A.UP_VOLUME) AS TOTAL_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) + SUM(A.UP_VOLUME) AS TOTAL_VOLUME_BYTES,
+A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Filter Operator
+            predicate: (my_date = DATE'2010-01-10') (type: boolean)
+            Select Operator
+              expressions: (down_volume_sum + up_volume_sum) (type: bigint), 
DATE'2010-01-10' (type: date), my_id2 (type: bigint), environment (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              ListSink
+
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+POSTHOOK: type: QUERY
+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 (CUSTOM_SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: default.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 64 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Filter Operator
+                    predicate: (my_date = DATE'2010-01-10') (type: boolean)
+                    Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: down_volume_sum (type: bigint)
+                      outputColumnNames: down_volume_sum
+                      Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: sum(down_volume_sum)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: bigint)
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                mode: mergepartial
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: COMPLETE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 8 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: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+TO_DATE('2010-01-10')
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+TO_DATE('2010-01-10')
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+POSTHOOK: type: QUERY
+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 (CUSTOM_SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: default.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 64 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Filter Operator
+                    predicate: (my_date = DATE'2010-01-10') (type: boolean)
+                    Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: down_volume_sum (type: bigint)
+                      outputColumnNames: down_volume_sum
+                      Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: sum(down_volume_sum)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 1 Data size: 8 Basic stats: 
COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: bigint)
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                mode: mergepartial
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: bigint), DATE'2010-01-10' (type: 
date)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 64 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 64 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: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+group by A.MY_DATE
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+A.MY_DATE
+FROM source_table_001 AS A
+where A.MY_DATE=TO_DATE('2010-01-10')
+group by A.MY_DATE
+POSTHOOK: type: QUERY
+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.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 64 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Filter Operator
+                    predicate: (my_date = DATE'2010-01-10') (type: boolean)
+                    Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: down_volume_sum (type: bigint)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        aggregations: sum(_col0)
+                        keys: DATE'2010-01-10' (type: date)
+                        mode: hash
+                        outputColumnNames: _col0, _col1
+                        Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: date)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: date)
+                          Statistics: Num rows: 1 Data size: 64 Basic stats: 
COMPLETE Column stats: COMPLETE
+                          value expressions: _col1 (type: bigint)
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: date)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1 Data size: 64 Basic stats: COMPLETE 
Column stats: COMPLETE
+                Select Operator
+                  expressions: _col1 (type: bigint), DATE'2010-01-10' (type: 
date)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 64 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 64 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: drop materialized view source_table_001_mv
+PREHOOK: type: DROP_MATERIALIZED_VIEW
+PREHOOK: Input: default@source_table_001_mv
+PREHOOK: Output: default@source_table_001_mv
+POSTHOOK: query: drop materialized view source_table_001_mv
+POSTHOOK: type: DROP_MATERIALIZED_VIEW
+POSTHOOK: Input: default@source_table_001_mv
+POSTHOOK: Output: default@source_table_001_mv

http://git-wip-us.apache.org/repos/asf/hive/blob/c695c70b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_9.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_9.q.out 
b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_9.q.out
new file mode 100644
index 0000000..63daf6c
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_rewrite_9.q.out
@@ -0,0 +1,389 @@
+PREHOOK: query: create table if not exists source_table_001 (
+MY_DATE timestamp,
+MY_ID bigint,
+MY_ID2 bigint,
+ENVIRONMENT string,
+DOWN_VOLUME bigint,
+UP_VOLUME bigint
+)
+stored AS ORC
+TBLPROPERTIES("transactional"="true")
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@source_table_001
+POSTHOOK: query: create table if not exists source_table_001 (
+MY_DATE timestamp,
+MY_ID bigint,
+MY_ID2 bigint,
+ENVIRONMENT string,
+DOWN_VOLUME bigint,
+UP_VOLUME bigint
+)
+stored AS ORC
+TBLPROPERTIES("transactional"="true")
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@source_table_001
+PREHOOK: query: insert into table source_table_001
+  values ('2010-10-10 00:00:00', 1, 1, 'env', 1, 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@source_table_001
+POSTHOOK: query: insert into table source_table_001
+  values ('2010-10-10 00:00:00', 1, 1, 'env', 1, 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@source_table_001
+POSTHOOK: Lineage: source_table_001.down_volume SCRIPT []
+POSTHOOK: Lineage: source_table_001.environment SCRIPT []
+POSTHOOK: Lineage: source_table_001.my_date SCRIPT []
+POSTHOOK: Lineage: source_table_001.my_id SCRIPT []
+POSTHOOK: Lineage: source_table_001.my_id2 SCRIPT []
+POSTHOOK: Lineage: source_table_001.up_volume SCRIPT []
+PREHOOK: query: analyze table source_table_001 compute statistics for columns
+PREHOOK: type: QUERY
+PREHOOK: Input: default@source_table_001
+PREHOOK: Output: default@source_table_001
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table source_table_001 compute statistics for columns
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@source_table_001
+POSTHOOK: Output: default@source_table_001
+#### A masked pattern was here ####
+PREHOOK: query: CREATE MATERIALIZED VIEW source_table_001_mv ENABLE REWRITE AS
+SELECT
+SUM(A.DOWN_VOLUME) AS DOWN_VOLUME_SUM,
+SUM(A.UP_VOLUME) AS UP_VOLUME_SUM,
+A.MY_ID,A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+from source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+PREHOOK: type: CREATE_MATERIALIZED_VIEW
+PREHOOK: Input: default@source_table_001
+PREHOOK: Output: database:default
+PREHOOK: Output: default@source_table_001_mv
+POSTHOOK: query: CREATE MATERIALIZED VIEW source_table_001_mv ENABLE REWRITE AS
+SELECT
+SUM(A.DOWN_VOLUME) AS DOWN_VOLUME_SUM,
+SUM(A.UP_VOLUME) AS UP_VOLUME_SUM,
+A.MY_ID,A.MY_DATE,A.MY_ID2,A.ENVIRONMENT
+from source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,A.MY_DATE
+POSTHOOK: type: CREATE_MATERIALIZED_VIEW
+POSTHOOK: Input: default@source_table_001
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@source_table_001_mv
+PREHOOK: query: analyze table source_table_001_mv compute statistics for 
columns
+PREHOOK: type: QUERY
+PREHOOK: Input: default@source_table_001_mv
+PREHOOK: Output: default@source_table_001_mv
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table source_table_001_mv compute statistics for 
columns
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@source_table_001_mv
+POSTHOOK: Output: default@source_table_001_mv
+#### A masked pattern was here ####
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to hour),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to hour)
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to hour),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to hour)
+POSTHOOK: type: QUERY
+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.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Select Operator
+                    expressions: down_volume_sum (type: bigint), my_id (type: 
bigint), my_id2 (type: bigint), environment (type: string), floor_hour(my_date) 
(type: timestamp)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                    Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      aggregations: sum(_col0)
+                      keys: _col1 (type: bigint), _col2 (type: bigint), _col3 
(type: string), _col4 (type: timestamp)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: bigint), _col1 (type: 
bigint), _col2 (type: string), _col3 (type: timestamp)
+                        sort order: ++++
+                        Map-reduce partition columns: _col0 (type: bigint), 
_col1 (type: bigint), _col2 (type: string), _col3 (type: timestamp)
+                        Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                        value expressions: _col4 (type: bigint)
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: bigint), KEY._col1 (type: bigint), 
KEY._col2 (type: string), KEY._col3 (type: timestamp)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                Select Operator
+                  expressions: _col4 (type: bigint), _col3 (type: timestamp), 
_col1 (type: bigint), _col2 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 1 Data size: 143 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 143 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: DROP MATERIALIZED VIEW source_table_001_mv
+PREHOOK: type: DROP_MATERIALIZED_VIEW
+PREHOOK: Input: default@source_table_001_mv
+PREHOOK: Output: default@source_table_001_mv
+POSTHOOK: query: DROP MATERIALIZED VIEW source_table_001_mv
+POSTHOOK: type: DROP_MATERIALIZED_VIEW
+POSTHOOK: Input: default@source_table_001_mv
+POSTHOOK: Output: default@source_table_001_mv
+PREHOOK: query: CREATE MATERIALIZED VIEW source_table_001_mv ENABLE REWRITE AS
+SELECT
+SUM(A.DOWN_VOLUME) AS DOWN_VOLUME_SUM,
+SUM(A.UP_VOLUME) AS UP_VOLUME_SUM,
+A.MY_ID,FLOOR(A.MY_DATE to hour),A.MY_ID2,A.ENVIRONMENT
+from source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to hour)
+PREHOOK: type: CREATE_MATERIALIZED_VIEW
+PREHOOK: Input: default@source_table_001
+PREHOOK: Output: database:default
+PREHOOK: Output: default@source_table_001_mv
+POSTHOOK: query: CREATE MATERIALIZED VIEW source_table_001_mv ENABLE REWRITE AS
+SELECT
+SUM(A.DOWN_VOLUME) AS DOWN_VOLUME_SUM,
+SUM(A.UP_VOLUME) AS UP_VOLUME_SUM,
+A.MY_ID,FLOOR(A.MY_DATE to hour),A.MY_ID2,A.ENVIRONMENT
+from source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to hour)
+POSTHOOK: type: CREATE_MATERIALIZED_VIEW
+POSTHOOK: Input: default@source_table_001
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@source_table_001_mv
+PREHOOK: query: analyze table source_table_001_mv compute statistics for 
columns
+PREHOOK: type: QUERY
+PREHOOK: Input: default@source_table_001_mv
+PREHOOK: Output: default@source_table_001_mv
+#### A masked pattern was here ####
+POSTHOOK: query: analyze table source_table_001_mv compute statistics for 
columns
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@source_table_001_mv
+POSTHOOK: Output: default@source_table_001_mv
+#### A masked pattern was here ####
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to day),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to day)
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to day),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to day)
+POSTHOOK: type: QUERY
+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.source_table_001_mv
+                  Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Select Operator
+                    expressions: down_volume_sum (type: bigint), my_id (type: 
bigint), my_id2 (type: bigint), environment (type: string), floor_day(_c3) 
(type: timestamp)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                    Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      aggregations: sum(_col0)
+                      keys: _col1 (type: bigint), _col2 (type: bigint), _col3 
(type: string), _col4 (type: timestamp)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: bigint), _col1 (type: 
bigint), _col2 (type: string), _col3 (type: timestamp)
+                        sort order: ++++
+                        Map-reduce partition columns: _col0 (type: bigint), 
_col1 (type: bigint), _col2 (type: string), _col3 (type: timestamp)
+                        Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                        value expressions: _col4 (type: bigint)
+            Execution mode: llap
+            LLAP IO: all inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: bigint), KEY._col1 (type: bigint), 
KEY._col2 (type: string), KEY._col3 (type: timestamp)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                Select Operator
+                  expressions: _col4 (type: bigint), _col3 (type: timestamp), 
_col1 (type: bigint), _col2 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 1 Data size: 143 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 143 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: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to hour),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to hour)
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to hour),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to hour)
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: default.source_table_001_mv
+          Select Operator
+            expressions: down_volume_sum (type: bigint), _c3 (type: 
timestamp), my_id2 (type: bigint), environment (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            ListSink
+
+PREHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to second),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to second)
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+SUM(A.DOWN_VOLUME) AS DOWNLOAD_VOLUME_BYTES,
+FLOOR(A.MY_DATE to second),A.MY_ID2,A.ENVIRONMENT
+FROM source_table_001 AS A
+group by A.MY_ID,A.MY_ID2,A.ENVIRONMENT,FLOOR(A.MY_DATE to second)
+POSTHOOK: type: QUERY
+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: a
+                  Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  Select Operator
+                    expressions: my_id (type: bigint), my_id2 (type: bigint), 
environment (type: string), floor_second(my_date) (type: timestamp), 
down_volume (type: bigint)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                    Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      aggregations: sum(_col4)
+                      keys: _col0 (type: bigint), _col1 (type: bigint), _col2 
(type: string), _col3 (type: timestamp)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: bigint), _col1 (type: 
bigint), _col2 (type: string), _col3 (type: timestamp)
+                        sort order: ++++
+                        Map-reduce partition columns: _col0 (type: bigint), 
_col1 (type: bigint), _col2 (type: string), _col3 (type: timestamp)
+                        Statistics: Num rows: 1 Data size: 151 Basic stats: 
COMPLETE Column stats: COMPLETE
+                        value expressions: _col4 (type: bigint)
+            Execution mode: llap
+            LLAP IO: may be used (ACID table)
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: bigint), KEY._col1 (type: bigint), 
KEY._col2 (type: string), KEY._col3 (type: timestamp)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                Statistics: Num rows: 1 Data size: 151 Basic stats: COMPLETE 
Column stats: COMPLETE
+                Select Operator
+                  expressions: _col4 (type: bigint), _col3 (type: timestamp), 
_col1 (type: bigint), _col2 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 1 Data size: 143 Basic stats: COMPLETE 
Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 143 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: DROP MATERIALIZED VIEW source_table_001_mv
+PREHOOK: type: DROP_MATERIALIZED_VIEW
+PREHOOK: Input: default@source_table_001_mv
+PREHOOK: Output: default@source_table_001_mv
+POSTHOOK: query: DROP MATERIALIZED VIEW source_table_001_mv
+POSTHOOK: type: DROP_MATERIALIZED_VIEW
+POSTHOOK: Input: default@source_table_001_mv
+POSTHOOK: Output: default@source_table_001_mv

http://git-wip-us.apache.org/repos/asf/hive/blob/c695c70b/ql/src/test/results/clientpositive/materialized_view_create_rewrite.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/materialized_view_create_rewrite.q.out 
b/ql/src/test/results/clientpositive/materialized_view_create_rewrite.q.out
deleted file mode 100644
index 18eb1d1..0000000
--- a/ql/src/test/results/clientpositive/materialized_view_create_rewrite.q.out
+++ /dev/null
@@ -1,477 +0,0 @@
-PREHOOK: query: create table cmv_basetable (a int, b varchar(256), c 
decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true')
-PREHOOK: type: CREATETABLE
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_basetable
-POSTHOOK: query: create table cmv_basetable (a int, b varchar(256), c 
decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true')
-POSTHOOK: type: CREATETABLE
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_basetable
-PREHOOK: query: insert into cmv_basetable values
- (1, 'alfred', 10.30, 2),
- (2, 'bob', 3.14, 3),
- (2, 'bonnie', 172342.2, 3),
- (3, 'calvin', 978.76, 3),
- (3, 'charlie', 9.8, 1)
-PREHOOK: type: QUERY
-PREHOOK: Input: _dummy_database@_dummy_table
-PREHOOK: Output: default@cmv_basetable
-POSTHOOK: query: insert into cmv_basetable values
- (1, 'alfred', 10.30, 2),
- (2, 'bob', 3.14, 3),
- (2, 'bonnie', 172342.2, 3),
- (3, 'calvin', 978.76, 3),
- (3, 'charlie', 9.8, 1)
-POSTHOOK: type: QUERY
-POSTHOOK: Input: _dummy_database@_dummy_table
-POSTHOOK: Output: default@cmv_basetable
-POSTHOOK: Lineage: cmv_basetable.a SCRIPT []
-POSTHOOK: Lineage: cmv_basetable.b SCRIPT []
-POSTHOOK: Lineage: cmv_basetable.c SCRIPT []
-POSTHOOK: Lineage: cmv_basetable.d SCRIPT []
-PREHOOK: query: analyze table cmv_basetable compute statistics for columns
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: default@cmv_basetable
-#### A masked pattern was here ####
-POSTHOOK: query: analyze table cmv_basetable compute statistics for columns
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: default@cmv_basetable
-#### A masked pattern was here ####
-PREHOOK: query: create materialized view cmv_mat_view enable rewrite
-as select a, b, c from cmv_basetable where a = 2
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view
-POSTHOOK: query: create materialized view cmv_mat_view enable rewrite
-as select a, b, c from cmv_basetable where a = 2
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view
-PREHOOK: query: select * from cmv_mat_view
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_mat_view
-#### A masked pattern was here ####
-POSTHOOK: query: select * from cmv_mat_view
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_mat_view
-#### A masked pattern was here ####
-2      bob     3.14
-2      bonnie  172342.20
-PREHOOK: query: show tblproperties cmv_mat_view
-PREHOOK: type: SHOW_TBLPROPERTIES
-POSTHOOK: query: show tblproperties cmv_mat_view
-POSTHOOK: type: SHOW_TBLPROPERTIES
-COLUMN_STATS_ACCURATE  {"BASIC_STATS":"true"}
-numFiles       1
-numRows        2
-rawDataSize    408
-totalSize      453
-#### A masked pattern was here ####
-PREHOOK: query: create materialized view if not exists cmv_mat_view2 enable 
rewrite
-as select a, c from cmv_basetable where a = 3
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view2
-POSTHOOK: query: create materialized view if not exists cmv_mat_view2 enable 
rewrite
-as select a, c from cmv_basetable where a = 3
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view2
-PREHOOK: query: select * from cmv_mat_view2
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_mat_view2
-#### A masked pattern was here ####
-POSTHOOK: query: select * from cmv_mat_view2
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_mat_view2
-#### A masked pattern was here ####
-3      9.80
-3      978.76
-PREHOOK: query: show tblproperties cmv_mat_view2
-PREHOOK: type: SHOW_TBLPROPERTIES
-POSTHOOK: query: show tblproperties cmv_mat_view2
-POSTHOOK: type: SHOW_TBLPROPERTIES
-COLUMN_STATS_ACCURATE  {"BASIC_STATS":"true"}
-numFiles       1
-numRows        2
-rawDataSize    232
-totalSize      322
-#### A masked pattern was here ####
-PREHOOK: query: explain
-select a, c from cmv_basetable where a = 3
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select a, c from cmv_basetable where a = 3
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-0 is a root stage
-
-STAGE PLANS:
-  Stage: Stage-0
-    Fetch Operator
-      limit: -1
-      Processor Tree:
-        TableScan
-          alias: default.cmv_mat_view2
-          Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: 3 (type: int), c (type: decimal(10,2))
-            outputColumnNames: _col0, _col1
-            Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE 
Column stats: NONE
-            ListSink
-
-PREHOOK: query: select a, c from cmv_basetable where a = 3
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_mat_view2
-#### A masked pattern was here ####
-POSTHOOK: query: select a, c from cmv_basetable where a = 3
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_mat_view2
-#### A masked pattern was here ####
-3      9.80
-3      978.76
-PREHOOK: query: alter materialized view cmv_mat_view2 disable rewrite
-PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE
-PREHOOK: Input: default@cmv_mat_view2
-PREHOOK: Output: default@cmv_mat_view2
-POSTHOOK: query: alter materialized view cmv_mat_view2 disable rewrite
-POSTHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE
-POSTHOOK: Input: default@cmv_mat_view2
-POSTHOOK: Output: default@cmv_mat_view2
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 
'Stage-1:MAPRED' is a cross product
-PREHOOK: query: explain
-select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (a = 3) (type: boolean)
-              Statistics: Num rows: 2 Data size: 482 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: c (type: decimal(10,2))
-                outputColumnNames: _col0
-                Statistics: Num rows: 2 Data size: 482 Basic stats: COMPLETE 
Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 2 Data size: 482 Basic stats: COMPLETE 
Column stats: NONE
-                  value expressions: _col0 (type: decimal(10,2))
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: ((a = 3) and (d = 3)) (type: boolean)
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: c (type: decimal(10,2))
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                  value expressions: _col0 (type: decimal(10,2))
-      Reduce Operator Tree:
-        Join Operator
-          condition map:
-               Inner Join 0 to 1
-          keys:
-            0 
-            1 
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 2 Data size: 966 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: 3 (type: int), _col0 (type: decimal(10,2)), 3 (type: 
int), _col1 (type: decimal(10,2))
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 2 Data size: 966 Basic stats: COMPLETE 
Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 2 Data size: 966 Basic stats: COMPLETE 
Column stats: NONE
-              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
-
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 
'Stage-1:MAPRED' is a cross product
-PREHOOK: query: select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-POSTHOOK: query: select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-3      9.80    3       978.76
-3      978.76  3       978.76
-PREHOOK: query: explain
-alter materialized view cmv_mat_view2 enable rewrite
-PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE
-POSTHOOK: query: explain
-alter materialized view cmv_mat_view2 enable rewrite
-POSTHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE
-STAGE DEPENDENCIES:
-  Stage-0 is a root stage
-
-STAGE PLANS:
-  Stage: Stage-0
-      Alter Materialized View Operator:
-        Alter Materialized View
-          name: default.cmv_mat_view2
-          operation: UPDATE_REWRITE_FLAG
-
-PREHOOK: query: alter materialized view cmv_mat_view2 enable rewrite
-PREHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE
-PREHOOK: Input: default@cmv_mat_view2
-PREHOOK: Output: default@cmv_mat_view2
-POSTHOOK: query: alter materialized view cmv_mat_view2 enable rewrite
-POSTHOOK: type: ALTER_MATERIALIZED_VIEW_REWRITE
-POSTHOOK: Input: default@cmv_mat_view2
-POSTHOOK: Output: default@cmv_mat_view2
-Warning: Shuffle Join JOIN[7][tables = [$hdt$_0, $hdt$_1]] in Stage 
'Stage-1:MAPRED' is a cross product
-PREHOOK: query: explain
-select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: default.cmv_mat_view2
-            Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE 
Column stats: NONE
-            Select Operator
-              expressions: c (type: decimal(10,2))
-              outputColumnNames: _col0
-              Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE 
Column stats: NONE
-              Reduce Output Operator
-                sort order: 
-                Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE 
Column stats: NONE
-                value expressions: _col0 (type: decimal(10,2))
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: ((a = 3) and (d = 3)) (type: boolean)
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: c (type: decimal(10,2))
-                outputColumnNames: _col1
-                Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                  value expressions: _col1 (type: decimal(10,2))
-      Reduce Operator Tree:
-        Join Operator
-          condition map:
-               Inner Join 0 to 1
-          keys:
-            0 
-            1 
-          outputColumnNames: _col0, _col2
-          Statistics: Num rows: 2 Data size: 716 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: 3 (type: int), _col0 (type: decimal(10,2)), 3 (type: 
int), _col2 (type: decimal(10,2))
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 2 Data size: 716 Basic stats: COMPLETE 
Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 2 Data size: 716 Basic stats: COMPLETE 
Column stats: NONE
-              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
-
-Warning: Shuffle Join JOIN[7][tables = [$hdt$_0, $hdt$_1]] in Stage 
'Stage-1:MAPRED' is a cross product
-PREHOOK: query: select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_mat_view2
-#### A masked pattern was here ####
-POSTHOOK: query: select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_mat_view2
-#### A masked pattern was here ####
-3      9.80    3       978.76
-3      978.76  3       978.76
-PREHOOK: query: drop materialized view cmv_mat_view2
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view2
-PREHOOK: Output: default@cmv_mat_view2
-POSTHOOK: query: drop materialized view cmv_mat_view2
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view2
-POSTHOOK: Output: default@cmv_mat_view2
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 
'Stage-1:MAPRED' is a cross product
-PREHOOK: query: explain
-select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (a = 3) (type: boolean)
-              Statistics: Num rows: 2 Data size: 482 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: c (type: decimal(10,2))
-                outputColumnNames: _col0
-                Statistics: Num rows: 2 Data size: 482 Basic stats: COMPLETE 
Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 2 Data size: 482 Basic stats: COMPLETE 
Column stats: NONE
-                  value expressions: _col0 (type: decimal(10,2))
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: ((a = 3) and (d = 3)) (type: boolean)
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: c (type: decimal(10,2))
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                  value expressions: _col0 (type: decimal(10,2))
-      Reduce Operator Tree:
-        Join Operator
-          condition map:
-               Inner Join 0 to 1
-          keys:
-            0 
-            1 
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 2 Data size: 966 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: 3 (type: int), _col0 (type: decimal(10,2)), 3 (type: 
int), _col1 (type: decimal(10,2))
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 2 Data size: 966 Basic stats: COMPLETE 
Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 2 Data size: 966 Basic stats: COMPLETE 
Column stats: NONE
-              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
-
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 
'Stage-1:MAPRED' is a cross product
-PREHOOK: query: select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-POSTHOOK: query: select * from (
-  (select a, c from cmv_basetable where a = 3) table1
-  join
-  (select a, c from cmv_basetable where d = 3) table2
-  on table1.a = table2.a)
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-3      9.80    3       978.76
-3      978.76  3       978.76
-PREHOOK: query: drop materialized view cmv_mat_view
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view
-PREHOOK: Output: default@cmv_mat_view
-POSTHOOK: query: drop materialized view cmv_mat_view
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view
-POSTHOOK: Output: default@cmv_mat_view

http://git-wip-us.apache.org/repos/asf/hive/blob/c695c70b/ql/src/test/results/clientpositive/materialized_view_create_rewrite_2.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/materialized_view_create_rewrite_2.q.out 
b/ql/src/test/results/clientpositive/materialized_view_create_rewrite_2.q.out
deleted file mode 100644
index 144f9d8..0000000
--- 
a/ql/src/test/results/clientpositive/materialized_view_create_rewrite_2.q.out
+++ /dev/null
@@ -1,598 +0,0 @@
-PREHOOK: query: create table cmv_basetable (a int, b varchar(256), c 
decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true')
-PREHOOK: type: CREATETABLE
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_basetable
-POSTHOOK: query: create table cmv_basetable (a int, b varchar(256), c 
decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true')
-POSTHOOK: type: CREATETABLE
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_basetable
-PREHOOK: query: insert into cmv_basetable values
- (1, 'alfred', 10.30, 2),
- (2, 'bob', 3.14, 3),
- (2, 'bonnie', 172342.2, 3),
- (3, 'calvin', 978.76, 3),
- (3, 'charlie', 9.8, 1)
-PREHOOK: type: QUERY
-PREHOOK: Input: _dummy_database@_dummy_table
-PREHOOK: Output: default@cmv_basetable
-POSTHOOK: query: insert into cmv_basetable values
- (1, 'alfred', 10.30, 2),
- (2, 'bob', 3.14, 3),
- (2, 'bonnie', 172342.2, 3),
- (3, 'calvin', 978.76, 3),
- (3, 'charlie', 9.8, 1)
-POSTHOOK: type: QUERY
-POSTHOOK: Input: _dummy_database@_dummy_table
-POSTHOOK: Output: default@cmv_basetable
-POSTHOOK: Lineage: cmv_basetable.a SCRIPT []
-POSTHOOK: Lineage: cmv_basetable.b SCRIPT []
-POSTHOOK: Lineage: cmv_basetable.c SCRIPT []
-POSTHOOK: Lineage: cmv_basetable.d SCRIPT []
-PREHOOK: query: analyze table cmv_basetable compute statistics for columns
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: default@cmv_basetable
-#### A masked pattern was here ####
-POSTHOOK: query: analyze table cmv_basetable compute statistics for columns
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: default@cmv_basetable
-#### A masked pattern was here ####
-PREHOOK: query: create materialized view cmv_mat_view enable rewrite
-as select b from cmv_basetable where c > 10.0 group by a, b, c
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view
-POSTHOOK: query: create materialized view cmv_mat_view enable rewrite
-as select b from cmv_basetable where c > 10.0 group by a, b, c
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view
-PREHOOK: query: explain
-select b from cmv_basetable where c > 20.0 group by a, b
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select b from cmv_basetable where c > 20.0 group by a, b
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (c > 20) (type: boolean)
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: a (type: int), b (type: varchar(256))
-                outputColumnNames: a, b
-                Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                Group By Operator
-                  keys: a (type: int), b (type: varchar(256))
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: 
varchar(256))
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 
(type: varchar(256))
-                    Statistics: Num rows: 1 Data size: 241 Basic stats: 
COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: int), KEY._col1 (type: varchar(256))
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: _col1 (type: varchar(256))
-            outputColumnNames: _col0
-            Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              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 b from cmv_basetable where c > 20.0 group by a, b
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-POSTHOOK: query: select b from cmv_basetable where c > 20.0 group by a, b
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-bonnie
-calvin
-PREHOOK: query: create materialized view cmv_mat_view_2 enable rewrite
-as select b, c from cmv_basetable where c > 10.0 group by a, b, c
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view_2
-POSTHOOK: query: create materialized view cmv_mat_view_2 enable rewrite
-as select b, c from cmv_basetable where c > 10.0 group by a, b, c
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view_2
-PREHOOK: query: explain
-select b from cmv_basetable where c > 20.0 group by a, b
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select b from cmv_basetable where c > 20.0 group by a, b
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: cmv_basetable
-            Statistics: Num rows: 5 Data size: 1205 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (c > 20) (type: boolean)
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: a (type: int), b (type: varchar(256))
-                outputColumnNames: a, b
-                Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                Group By Operator
-                  keys: a (type: int), b (type: varchar(256))
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: 
varchar(256))
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 
(type: varchar(256))
-                    Statistics: Num rows: 1 Data size: 241 Basic stats: 
COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: int), KEY._col1 (type: varchar(256))
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: _col1 (type: varchar(256))
-            outputColumnNames: _col0
-            Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 1 Data size: 241 Basic stats: COMPLETE 
Column stats: NONE
-              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 b from cmv_basetable where c > 20.0 group by a, b
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-POSTHOOK: query: select b from cmv_basetable where c > 20.0 group by a, b
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-#### A masked pattern was here ####
-bonnie
-calvin
-PREHOOK: query: create materialized view cmv_mat_view_3 enable rewrite
-as select a, b, c from cmv_basetable where c > 10.0 group by a, b, c
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view_3
-POSTHOOK: query: create materialized view cmv_mat_view_3 enable rewrite
-as select a, b, c from cmv_basetable where c > 10.0 group by a, b, c
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view_3
-PREHOOK: query: explain
-select b from cmv_basetable where c > 20.0 group by a, b
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select b from cmv_basetable where c > 20.0 group by a, b
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: default.cmv_mat_view_3
-            Statistics: Num rows: 3 Data size: 618 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (c > 20) (type: boolean)
-              Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: a (type: int), b (type: varchar(256))
-                outputColumnNames: a, b
-                Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE 
Column stats: NONE
-                Group By Operator
-                  keys: a (type: int), b (type: varchar(256))
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE 
Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: 
varchar(256))
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 
(type: varchar(256))
-                    Statistics: Num rows: 1 Data size: 206 Basic stats: 
COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: int), KEY._col1 (type: varchar(256))
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE Column 
stats: NONE
-          Select Operator
-            expressions: _col1 (type: varchar(256))
-            outputColumnNames: _col0
-            Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE 
Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE 
Column stats: NONE
-              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 b from cmv_basetable where c > 20.0 group by a, b
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_mat_view_3
-#### A masked pattern was here ####
-POSTHOOK: query: select b from cmv_basetable where c > 20.0 group by a, b
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_mat_view_3
-#### A masked pattern was here ####
-bonnie
-calvin
-PREHOOK: query: create materialized view cmv_mat_view_4 enable rewrite
-as select a, b from cmv_basetable group by a, b
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view_4
-POSTHOOK: query: create materialized view cmv_mat_view_4 enable rewrite
-as select a, b from cmv_basetable group by a, b
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view_4
-PREHOOK: query: explain
-select b from cmv_basetable group by b
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select b from cmv_basetable group by b
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: default.cmv_mat_view_4
-            Statistics: Num rows: 5 Data size: 465 Basic stats: COMPLETE 
Column stats: NONE
-            Select Operator
-              expressions: b (type: varchar(256))
-              outputColumnNames: b
-              Statistics: Num rows: 5 Data size: 465 Basic stats: COMPLETE 
Column stats: NONE
-              Group By Operator
-                keys: b (type: varchar(256))
-                mode: hash
-                outputColumnNames: _col0
-                Statistics: Num rows: 5 Data size: 465 Basic stats: COMPLETE 
Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: varchar(256))
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: varchar(256))
-                  Statistics: Num rows: 5 Data size: 465 Basic stats: COMPLETE 
Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: varchar(256))
-          mode: mergepartial
-          outputColumnNames: _col0
-          Statistics: Num rows: 2 Data size: 186 Basic stats: COMPLETE Column 
stats: NONE
-          File Output Operator
-            compressed: false
-            Statistics: Num rows: 2 Data size: 186 Basic stats: COMPLETE 
Column stats: NONE
-            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 b from cmv_basetable group by b
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_mat_view_4
-#### A masked pattern was here ####
-POSTHOOK: query: select b from cmv_basetable group by b
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_mat_view_4
-#### A masked pattern was here ####
-alfred
-bob
-bonnie
-calvin
-charlie
-PREHOOK: query: create table cmv_basetable_2 (a int, b varchar(256), c 
decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true')
-PREHOOK: type: CREATETABLE
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_basetable_2
-POSTHOOK: query: create table cmv_basetable_2 (a int, b varchar(256), c 
decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true')
-POSTHOOK: type: CREATETABLE
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_basetable_2
-PREHOOK: query: insert into cmv_basetable_2 values
- (1, 'alfred', 10.30, 2),
- (3, 'calvin', 978.76, 3)
-PREHOOK: type: QUERY
-PREHOOK: Input: _dummy_database@_dummy_table
-PREHOOK: Output: default@cmv_basetable_2
-POSTHOOK: query: insert into cmv_basetable_2 values
- (1, 'alfred', 10.30, 2),
- (3, 'calvin', 978.76, 3)
-POSTHOOK: type: QUERY
-POSTHOOK: Input: _dummy_database@_dummy_table
-POSTHOOK: Output: default@cmv_basetable_2
-POSTHOOK: Lineage: cmv_basetable_2.a SCRIPT []
-POSTHOOK: Lineage: cmv_basetable_2.b SCRIPT []
-POSTHOOK: Lineage: cmv_basetable_2.c SCRIPT []
-POSTHOOK: Lineage: cmv_basetable_2.d SCRIPT []
-PREHOOK: query: analyze table cmv_basetable_2 compute statistics for columns
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable_2
-PREHOOK: Output: default@cmv_basetable_2
-#### A masked pattern was here ####
-POSTHOOK: query: analyze table cmv_basetable_2 compute statistics for columns
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable_2
-POSTHOOK: Output: default@cmv_basetable_2
-#### A masked pattern was here ####
-PREHOOK: query: create materialized view cmv_mat_view_5 enable rewrite
-as select cmv_basetable.a, cmv_basetable_2.c
-   from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-   where cmv_basetable_2.c > 10.0
-   group by cmv_basetable.a, cmv_basetable_2.c
-PREHOOK: type: CREATE_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_basetable_2
-PREHOOK: Output: database:default
-PREHOOK: Output: default@cmv_mat_view_5
-POSTHOOK: query: create materialized view cmv_mat_view_5 enable rewrite
-as select cmv_basetable.a, cmv_basetable_2.c
-   from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-   where cmv_basetable_2.c > 10.0
-   group by cmv_basetable.a, cmv_basetable_2.c
-POSTHOOK: type: CREATE_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_basetable_2
-POSTHOOK: Output: database:default
-POSTHOOK: Output: default@cmv_mat_view_5
-PREHOOK: query: explain
-select cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a, cmv_basetable_2.c
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a, cmv_basetable_2.c
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: default.cmv_mat_view_5
-            Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (c > 10.1) (type: boolean)
-              Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: a (type: int)
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-                  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 cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a, cmv_basetable_2.c
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_basetable_2
-PREHOOK: Input: default@cmv_mat_view_5
-#### A masked pattern was here ####
-POSTHOOK: query: select cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a, cmv_basetable_2.c
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_basetable_2
-POSTHOOK: Input: default@cmv_mat_view_5
-#### A masked pattern was here ####
-1
-3
-PREHOOK: query: explain
-select cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a
-PREHOOK: type: QUERY
-POSTHOOK: query: explain
-select cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a
-POSTHOOK: type: QUERY
-STAGE DEPENDENCIES:
-  Stage-1 is a root stage
-  Stage-0 depends on stages: Stage-1
-
-STAGE PLANS:
-  Stage: Stage-1
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            alias: default.cmv_mat_view_5
-            Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE 
Column stats: NONE
-            Filter Operator
-              predicate: (c > 10.1) (type: boolean)
-              Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-              Select Operator
-                expressions: a (type: int)
-                outputColumnNames: a
-                Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-                Group By Operator
-                  keys: a (type: int)
-                  mode: hash
-                  outputColumnNames: _col0
-                  Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 1 Data size: 116 Basic stats: 
COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0
-          Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column 
stats: NONE
-          File Output Operator
-            compressed: false
-            Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE 
Column stats: NONE
-            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 cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a
-PREHOOK: type: QUERY
-PREHOOK: Input: default@cmv_basetable
-PREHOOK: Input: default@cmv_basetable_2
-PREHOOK: Input: default@cmv_mat_view_5
-#### A masked pattern was here ####
-POSTHOOK: query: select cmv_basetable.a
-from cmv_basetable join cmv_basetable_2 on (cmv_basetable.a = 
cmv_basetable_2.a)
-where cmv_basetable_2.c > 10.10
-group by cmv_basetable.a
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@cmv_basetable
-POSTHOOK: Input: default@cmv_basetable_2
-POSTHOOK: Input: default@cmv_mat_view_5
-#### A masked pattern was here ####
-1
-3
-PREHOOK: query: drop materialized view cmv_mat_view
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view
-PREHOOK: Output: default@cmv_mat_view
-POSTHOOK: query: drop materialized view cmv_mat_view
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view
-POSTHOOK: Output: default@cmv_mat_view
-PREHOOK: query: drop materialized view cmv_mat_view_2
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view_2
-PREHOOK: Output: default@cmv_mat_view_2
-POSTHOOK: query: drop materialized view cmv_mat_view_2
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view_2
-POSTHOOK: Output: default@cmv_mat_view_2
-PREHOOK: query: drop materialized view cmv_mat_view_3
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view_3
-PREHOOK: Output: default@cmv_mat_view_3
-POSTHOOK: query: drop materialized view cmv_mat_view_3
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view_3
-POSTHOOK: Output: default@cmv_mat_view_3
-PREHOOK: query: drop materialized view cmv_mat_view_4
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view_4
-PREHOOK: Output: default@cmv_mat_view_4
-POSTHOOK: query: drop materialized view cmv_mat_view_4
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view_4
-POSTHOOK: Output: default@cmv_mat_view_4
-PREHOOK: query: drop materialized view cmv_mat_view_5
-PREHOOK: type: DROP_MATERIALIZED_VIEW
-PREHOOK: Input: default@cmv_mat_view_5
-PREHOOK: Output: default@cmv_mat_view_5
-POSTHOOK: query: drop materialized view cmv_mat_view_5
-POSTHOOK: type: DROP_MATERIALIZED_VIEW
-POSTHOOK: Input: default@cmv_mat_view_5
-POSTHOOK: Output: default@cmv_mat_view_5

Reply via email to