You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2017/04/13 20:50:27 UTC

[22/26] hive git commit: HIVE-15708 : Upgrade calcite version to 1.12 (Remus Rusanu via Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/be59e024/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
index a69f2ad..584c3b5 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
@@ -346,11 +346,10 @@ Plan optimized by CBO.
 
 Vertex dependency in root stage
 Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Reducer 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
-Reducer 5 <- Map 11 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
-Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 6 <- Map 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
 Reducer 9 <- Map 8 (SIMPLE_EDGE)
 
@@ -358,85 +357,76 @@ Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 7 llap
-      File Output Operator [FS_42]
-        Select Operator [SEL_41] (rows=1 width=20)
+      Reducer 4 llap
+      File Output Operator [FS_38]
+        Select Operator [SEL_37] (rows=1 width=20)
           Output:["_col0","_col1","_col2"]
-        <-Reducer 6 [SIMPLE_EDGE] llap
-          SHUFFLE [RS_40]
-            Select Operator [SEL_38] (rows=1 width=20)
+        <-Reducer 3 [SIMPLE_EDGE] llap
+          SHUFFLE [RS_36]
+            Select Operator [SEL_35] (rows=1 width=20)
               Output:["_col0","_col1","_col2"]
-              Group By Operator [GBY_37] (rows=1 width=20)
+              Group By Operator [GBY_34] (rows=1 width=20)
                 Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
-              <-Reducer 5 [SIMPLE_EDGE] llap
-                SHUFFLE [RS_36]
+              <-Reducer 2 [SIMPLE_EDGE] llap
+                SHUFFLE [RS_33]
                   PartitionCols:_col0, _col1
-                  Group By Operator [GBY_35] (rows=1 width=20)
-                    Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col2, _col6
-                    Select Operator [SEL_34] (rows=3 width=16)
-                      Output:["_col2","_col6"]
-                      Filter Operator [FIL_33] (rows=3 width=16)
-                        predicate:((_col1 > 0) or (_col6 >= 0))
-                        Merge Join Operator [MERGEJOIN_52] (rows=3 width=16)
-                          Conds:RS_30._col0=RS_31._col0(Inner),Output:["_col1","_col2","_col6"]
-                        <-Map 11 [SIMPLE_EDGE] llap
-                          SHUFFLE [RS_31]
+                  Group By Operator [GBY_32] (rows=1 width=20)
+                    Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col4, _col1
+                    Select Operator [SEL_31] (rows=1 width=20)
+                      Output:["_col1","_col4"]
+                      Filter Operator [FIL_29] (rows=1 width=20)
+                        predicate:(((_col3 + _col6) >= 0) and ((_col3 > 0) or (_col1 >= 0)))
+                        Merge Join Operator [MERGEJOIN_48] (rows=3 width=20)
+                          Conds:RS_25._col0=RS_26._col0(Inner),RS_26._col0=RS_27._col0(Inner),Output:["_col1","_col3","_col4","_col6"]
+                        <-Map 1 [SIMPLE_EDGE] llap
+                          SHUFFLE [RS_25]
                             PartitionCols:_col0
-                            Select Operator [SEL_29] (rows=18 width=84)
+                            Select Operator [SEL_2] (rows=18 width=84)
                               Output:["_col0","_col1"]
-                              Filter Operator [FIL_50] (rows=18 width=84)
+                              Filter Operator [FIL_45] (rows=18 width=84)
                                 predicate:key is not null
-                                TableScan [TS_27] (rows=20 width=84)
+                                TableScan [TS_0] (rows=20 width=84)
                                   default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-                        <-Reducer 4 [SIMPLE_EDGE] llap
-                          SHUFFLE [RS_30]
+                        <-Reducer 10 [SIMPLE_EDGE] llap
+                          SHUFFLE [RS_27]
+                            PartitionCols:_col0
+                            Select Operator [SEL_23] (rows=1 width=89)
+                              Output:["_col0","_col1"]
+                            <-Reducer 9 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_22]
+                                Select Operator [SEL_20] (rows=1 width=105)
+                                  Output:["_col0","_col1","_col2","_col3"]
+                                  Group By Operator [GBY_19] (rows=1 width=101)
+                                    Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                                  <-Map 8 [SIMPLE_EDGE] llap
+                                    SHUFFLE [RS_18]
+                                      PartitionCols:_col0, _col1, _col2
+                                      Group By Operator [GBY_17] (rows=2 width=101)
+                                        Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                        Filter Operator [FIL_47] (rows=5 width=93)
+                                          predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and key is not null)
+                                          TableScan [TS_14] (rows=20 width=88)
+                                            default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                        <-Reducer 7 [SIMPLE_EDGE] llap
+                          SHUFFLE [RS_26]
                             PartitionCols:_col0
-                            Select Operator [SEL_26] (rows=1 width=101)
+                            Select Operator [SEL_12] (rows=1 width=97)
                               Output:["_col0","_col1","_col2"]
-                              Filter Operator [FIL_25] (rows=1 width=101)
-                                predicate:((_col1 + _col4) >= 0)
-                                Merge Join Operator [MERGEJOIN_51] (rows=1 width=101)
-                                  Conds:RS_22._col0=RS_23._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
-                                <-Reducer 10 [SIMPLE_EDGE] llap
-                                  SHUFFLE [RS_23]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_20] (rows=1 width=89)
-                                      Output:["_col0","_col1"]
-                                    <-Reducer 9 [SIMPLE_EDGE] llap
-                                      SHUFFLE [RS_19]
-                                        Select Operator [SEL_17] (rows=1 width=105)
-                                          Output:["_col0","_col1","_col2","_col3"]
-                                          Group By Operator [GBY_16] (rows=1 width=101)
-                                            Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                          <-Map 8 [SIMPLE_EDGE] llap
-                                            SHUFFLE [RS_15]
-                                              PartitionCols:_col0, _col1, _col2
-                                              Group By Operator [GBY_14] (rows=2 width=101)
-                                                Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                                Filter Operator [FIL_49] (rows=5 width=93)
-                                                  predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and key is not null)
-                                                  TableScan [TS_11] (rows=20 width=88)
-                                                    default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                                <-Reducer 3 [SIMPLE_EDGE] llap
-                                  SHUFFLE [RS_22]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_9] (rows=1 width=97)
-                                      Output:["_col0","_col1","_col2"]
-                                    <-Reducer 2 [SIMPLE_EDGE] llap
-                                      SHUFFLE [RS_8]
-                                        Select Operator [SEL_6] (rows=1 width=97)
-                                          Output:["_col0","_col1","_col2"]
-                                          Group By Operator [GBY_5] (rows=1 width=101)
-                                            Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                          <-Map 1 [SIMPLE_EDGE] llap
-                                            SHUFFLE [RS_4]
-                                              PartitionCols:_col0, _col1, _col2
-                                              Group By Operator [GBY_3] (rows=2 width=101)
-                                                Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                                Filter Operator [FIL_48] (rows=5 width=93)
-                                                  predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and key is not null)
-                                                  TableScan [TS_0] (rows=20 width=88)
-                                                    default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                            <-Reducer 6 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_11]
+                                Select Operator [SEL_9] (rows=1 width=97)
+                                  Output:["_col0","_col1","_col2"]
+                                  Group By Operator [GBY_8] (rows=1 width=101)
+                                    Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                                  <-Map 5 [SIMPLE_EDGE] llap
+                                    SHUFFLE [RS_7]
+                                      PartitionCols:_col0, _col1, _col2
+                                      Group By Operator [GBY_6] (rows=2 width=101)
+                                        Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                        Filter Operator [FIL_46] (rows=5 width=93)
+                                          predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and key is not null)
+                                          TableScan [TS_3] (rows=20 width=88)
+                                            default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select cbo_t3.c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1 where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)  group by c_float, cbo_t1.c_int, key having cbo_t1.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by b % c asc, b desc) cbo_t1 left outer join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2 where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)  group by c_float, cbo_t2.c_int, key  having cbo_t2.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) cbo_t2 on cbo_t1.a=p left outer join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q >= 0) and (b > 0 or c_int >= 0) group by cbo_t3.c_int, c  having cbo_t3.c_int > 0 and (c_int >=1 or c >= 1) and (c_int + c) >= 0  order by cbo_t3.c_int % c asc, cbo_t3.c_int desc
 PREHOOK: type: QUERY
@@ -445,11 +435,10 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Reducer 3 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
-Reducer 5 <- Map 10 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
-Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 6 <- Map 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
 Reducer 9 <- Map 8 (SIMPLE_EDGE)
 
@@ -457,79 +446,70 @@ Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 7 llap
-      File Output Operator [FS_39]
-        Select Operator [SEL_38] (rows=1 width=20)
+      Reducer 4 llap
+      File Output Operator [FS_37]
+        Select Operator [SEL_36] (rows=1 width=20)
           Output:["_col0","_col1","_col2"]
-        <-Reducer 6 [SIMPLE_EDGE] llap
-          SHUFFLE [RS_37]
-            Group By Operator [GBY_34] (rows=1 width=20)
+        <-Reducer 3 [SIMPLE_EDGE] llap
+          SHUFFLE [RS_35]
+            Group By Operator [GBY_33] (rows=1 width=20)
               Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
-            <-Reducer 5 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_33]
+            <-Reducer 2 [SIMPLE_EDGE] llap
+              SHUFFLE [RS_32]
                 PartitionCols:_col0, _col1
-                Group By Operator [GBY_32] (rows=1 width=20)
-                  Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col6, _col2
-                  Select Operator [SEL_31] (rows=1 width=16)
-                    Output:["_col2","_col6"]
-                    Filter Operator [FIL_30] (rows=1 width=16)
-                      predicate:(((_col1 > 0) or (_col6 >= 0)) and ((_col6 >= 1) or (_col2 >= 1)) and ((UDFToLong(_col6) + _col2) >= 0))
-                      Merge Join Operator [MERGEJOIN_48] (rows=3 width=16)
-                        Conds:RS_27._col0=RS_28._col0(Inner),Output:["_col1","_col2","_col6"]
-                      <-Map 10 [SIMPLE_EDGE] llap
-                        SHUFFLE [RS_28]
+                Group By Operator [GBY_31] (rows=1 width=20)
+                  Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
+                  Select Operator [SEL_30] (rows=1 width=20)
+                    Output:["_col1","_col4"]
+                    Filter Operator [FIL_26] (rows=1 width=20)
+                      predicate:(((_col3 + _col6) >= 0) and ((UDFToLong(_col1) + _col4) >= 0) and ((_col1 >= 1) or (_col4 >= 1)) and ((_col3 > 0) or (_col1 >= 0)))
+                      Merge Join Operator [MERGEJOIN_47] (rows=3 width=20)
+                        Conds:RS_22._col0=RS_23._col0(Inner),RS_23._col0=RS_24._col0(Inner),Output:["_col1","_col3","_col4","_col6"]
+                      <-Map 1 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_22]
                           PartitionCols:_col0
-                          Select Operator [SEL_26] (rows=18 width=84)
+                          Select Operator [SEL_2] (rows=18 width=84)
                             Output:["_col0","_col1"]
-                            Filter Operator [FIL_46] (rows=18 width=84)
+                            Filter Operator [FIL_44] (rows=18 width=84)
                               predicate:((c_int > 0) and key is not null)
-                              TableScan [TS_24] (rows=20 width=84)
+                              TableScan [TS_0] (rows=20 width=84)
                                 default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-                      <-Reducer 4 [SIMPLE_EDGE] llap
-                        SHUFFLE [RS_27]
+                      <-Reducer 7 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_23]
                           PartitionCols:_col0
-                          Select Operator [SEL_23] (rows=1 width=101)
+                          Select Operator [SEL_12] (rows=1 width=97)
                             Output:["_col0","_col1","_col2"]
-                            Filter Operator [FIL_22] (rows=1 width=101)
-                              predicate:((_col1 + _col4) >= 0)
-                              Merge Join Operator [MERGEJOIN_47] (rows=1 width=101)
-                                Conds:RS_19._col0=RS_20._col0(Left Outer),Output:["_col0","_col1","_col2","_col4"]
-                              <-Reducer 3 [SIMPLE_EDGE] llap
-                                SHUFFLE [RS_19]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_9] (rows=1 width=97)
-                                    Output:["_col0","_col1","_col2"]
-                                  <-Reducer 2 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_8]
-                                      Select Operator [SEL_6] (rows=1 width=105)
-                                        Output:["_col0","_col1","_col2","_col3"]
-                                        Group By Operator [GBY_5] (rows=1 width=101)
-                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                        <-Map 1 [SIMPLE_EDGE] llap
-                                          SHUFFLE [RS_4]
-                                            PartitionCols:_col0, _col1, _col2
-                                            Group By Operator [GBY_3] (rows=1 width=101)
-                                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                              Filter Operator [FIL_44] (rows=2 width=93)
-                                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0) and key is not null)
-                                                TableScan [TS_0] (rows=20 width=88)
-                                                  default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                              <-Reducer 9 [SIMPLE_EDGE] llap
-                                SHUFFLE [RS_20]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_17] (rows=1 width=89)
-                                    Output:["_col0","_col1"]
-                                    Group By Operator [GBY_16] (rows=1 width=93)
-                                      Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
-                                    <-Map 8 [SIMPLE_EDGE] llap
-                                      SHUFFLE [RS_15]
-                                        PartitionCols:_col0, _col1, _col2
-                                        Group By Operator [GBY_14] (rows=1 width=93)
-                                          Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
-                                          Filter Operator [FIL_45] (rows=2 width=93)
-                                            predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0) and key is not null)
-                                            TableScan [TS_11] (rows=20 width=88)
-                                              default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                          <-Reducer 6 [SIMPLE_EDGE] llap
+                            SHUFFLE [RS_11]
+                              Select Operator [SEL_9] (rows=1 width=105)
+                                Output:["_col0","_col1","_col2","_col3"]
+                                Group By Operator [GBY_8] (rows=1 width=101)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                                <-Map 5 [SIMPLE_EDGE] llap
+                                  SHUFFLE [RS_7]
+                                    PartitionCols:_col0, _col1, _col2
+                                    Group By Operator [GBY_6] (rows=1 width=101)
+                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                      Filter Operator [FIL_45] (rows=2 width=93)
+                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                        TableScan [TS_3] (rows=20 width=88)
+                                          default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                      <-Reducer 9 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_24]
+                          PartitionCols:_col0
+                          Select Operator [SEL_20] (rows=1 width=89)
+                            Output:["_col0","_col1"]
+                            Group By Operator [GBY_19] (rows=1 width=93)
+                              Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
+                            <-Map 8 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_18]
+                                PartitionCols:_col0, _col1, _col2
+                                Group By Operator [GBY_17] (rows=1 width=93)
+                                  Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
+                                  Filter Operator [FIL_46] (rows=2 width=93)
+                                    predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                    TableScan [TS_14] (rows=20 width=88)
+                                      default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select cbo_t3.c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1 where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)  group by c_float, cbo_t1.c_int, key having cbo_t1.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by b+c, a desc) cbo_t1 right outer join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2 where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)  group by c_float, cbo_t2.c_int, key having cbo_t2.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) cbo_t2 on cbo_t1.a=p right outer join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q >= 2) and (b > 0 or c_int >= 0) group by cbo_t3.c_int, c
 PREHOOK: type: QUERY
@@ -538,76 +518,76 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 8 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
-Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
-Reducer 7 <- Map 6 (SIMPLE_EDGE)
+Reducer 5 <- Map 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 8 <- Map 7 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 5 llap
-      File Output Operator [FS_31]
-        Select Operator [SEL_30] (rows=1 width=20)
-          Output:["_col0","_col1","_col2"]
-          Group By Operator [GBY_29] (rows=1 width=20)
-            Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
-          <-Reducer 4 [SIMPLE_EDGE] llap
-            SHUFFLE [RS_28]
-              PartitionCols:_col0, _col1
-              Group By Operator [GBY_27] (rows=1 width=20)
-                Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col2, _col6
-                Select Operator [SEL_26] (rows=1 width=20)
-                  Output:["_col2","_col6"]
-                  Filter Operator [FIL_25] (rows=1 width=20)
-                    predicate:(((_col1 + _col4) >= 2) and ((_col1 > 0) or (_col6 >= 0)))
-                    Merge Join Operator [MERGEJOIN_36] (rows=4 width=20)
-                      Conds:RS_21._col0=RS_22._col0(Right Outer),RS_21._col0=RS_23._col0(Right Outer),Output:["_col1","_col2","_col4","_col6"]
-                    <-Map 8 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_23]
-                        PartitionCols:_col0
-                        Select Operator [SEL_20] (rows=20 width=84)
-                          Output:["_col0","_col1"]
-                          TableScan [TS_19] (rows=20 width=84)
+      Reducer 3 llap
+      File Output Operator [FS_33]
+        Group By Operator [GBY_31] (rows=1 width=20)
+          Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
+        <-Reducer 2 [SIMPLE_EDGE] llap
+          SHUFFLE [RS_30]
+            PartitionCols:_col0, _col1
+            Group By Operator [GBY_29] (rows=1 width=20)
+              Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
+              Select Operator [SEL_28] (rows=1 width=20)
+                Output:["_col1","_col4"]
+                Filter Operator [FIL_26] (rows=1 width=20)
+                  predicate:(((_col3 + _col6) >= 2) and ((_col3 > 0) or (_col1 >= 0)))
+                  Merge Join Operator [MERGEJOIN_43] (rows=3 width=20)
+                    Conds:RS_22._col0=RS_23._col0(Inner),RS_23._col0=RS_24._col0(Inner),Output:["_col1","_col3","_col4","_col6"]
+                  <-Map 1 [SIMPLE_EDGE] llap
+                    SHUFFLE [RS_22]
+                      PartitionCols:_col0
+                      Select Operator [SEL_2] (rows=18 width=84)
+                        Output:["_col0","_col1"]
+                        Filter Operator [FIL_40] (rows=18 width=84)
+                          predicate:key is not null
+                          TableScan [TS_0] (rows=20 width=84)
                             default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-                    <-Reducer 3 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_21]
-                        PartitionCols:_col0
-                        Select Operator [SEL_9] (rows=1 width=97)
-                          Output:["_col0","_col1","_col2"]
-                        <-Reducer 2 [SIMPLE_EDGE] llap
-                          SHUFFLE [RS_8]
-                            Select Operator [SEL_6] (rows=1 width=105)
-                              Output:["_col0","_col1","_col2","_col3"]
-                              Group By Operator [GBY_5] (rows=1 width=101)
-                                Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                              <-Map 1 [SIMPLE_EDGE] llap
-                                SHUFFLE [RS_4]
-                                  PartitionCols:_col0, _col1, _col2
-                                  Group By Operator [GBY_3] (rows=1 width=101)
-                                    Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                    Filter Operator [FIL_34] (rows=2 width=93)
-                                      predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0))
-                                      TableScan [TS_0] (rows=20 width=88)
-                                        default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                    <-Reducer 7 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_22]
-                        PartitionCols:_col0
-                        Select Operator [SEL_17] (rows=1 width=89)
-                          Output:["_col0","_col1"]
-                          Group By Operator [GBY_16] (rows=1 width=93)
-                            Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
-                          <-Map 6 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_15]
-                              PartitionCols:_col0, _col1, _col2
-                              Group By Operator [GBY_14] (rows=1 width=93)
-                                Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
-                                Filter Operator [FIL_35] (rows=2 width=93)
-                                  predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0))
-                                  TableScan [TS_11] (rows=20 width=88)
-                                    default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                  <-Reducer 6 [SIMPLE_EDGE] llap
+                    SHUFFLE [RS_23]
+                      PartitionCols:_col0
+                      Select Operator [SEL_12] (rows=1 width=97)
+                        Output:["_col0","_col1","_col2"]
+                      <-Reducer 5 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_11]
+                          Select Operator [SEL_9] (rows=1 width=105)
+                            Output:["_col0","_col1","_col2","_col3"]
+                            Group By Operator [GBY_8] (rows=1 width=101)
+                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                            <-Map 4 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_7]
+                                PartitionCols:_col0, _col1, _col2
+                                Group By Operator [GBY_6] (rows=1 width=101)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                  Filter Operator [FIL_41] (rows=2 width=93)
+                                    predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                    TableScan [TS_3] (rows=20 width=88)
+                                      default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                  <-Reducer 8 [SIMPLE_EDGE] llap
+                    SHUFFLE [RS_24]
+                      PartitionCols:_col0
+                      Select Operator [SEL_20] (rows=1 width=89)
+                        Output:["_col0","_col1"]
+                        Group By Operator [GBY_19] (rows=1 width=93)
+                          Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
+                        <-Map 7 [SIMPLE_EDGE] llap
+                          SHUFFLE [RS_18]
+                            PartitionCols:_col0, _col1, _col2
+                            Group By Operator [GBY_17] (rows=1 width=93)
+                              Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
+                              Filter Operator [FIL_42] (rows=2 width=93)
+                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                TableScan [TS_14] (rows=20 width=88)
+                                  default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select cbo_t3.c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1 where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)  group by c_float, cbo_t1.c_int, key having cbo_t1.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by c+a desc) cbo_t1 full outer join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2 where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)  group by c_float, cbo_t2.c_int, key having cbo_t2.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by p+q desc, r asc) cbo_t2 on cbo_t1.a=p full outer join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q >= 0) and (b > 0 or c_int >= 0) group by cbo_t3.c_int, c having cbo_t3.c_int > 0 and (c_int >=1 or c >= 1) and (c_int + c) >= 0 order by cbo_t3.c_int
 PREHOOK: type: QUERY
@@ -616,86 +596,86 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE)
+Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
-Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
-Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
-Reducer 8 <- Map 7 (SIMPLE_EDGE)
-Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 6 <- Map 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+Reducer 9 <- Map 8 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 6 llap
-      File Output Operator [FS_37]
-        Select Operator [SEL_36] (rows=1 width=20)
+      Reducer 4 llap
+      File Output Operator [FS_40]
+        Select Operator [SEL_39] (rows=1 width=20)
           Output:["_col0","_col1","_col2"]
-        <-Reducer 5 [SIMPLE_EDGE] llap
-          SHUFFLE [RS_35]
-            Group By Operator [GBY_33] (rows=1 width=20)
+        <-Reducer 3 [SIMPLE_EDGE] llap
+          SHUFFLE [RS_38]
+            Group By Operator [GBY_36] (rows=1 width=20)
               Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
-            <-Reducer 4 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_32]
+            <-Reducer 2 [SIMPLE_EDGE] llap
+              SHUFFLE [RS_35]
                 PartitionCols:_col0, _col1
-                Group By Operator [GBY_31] (rows=1 width=20)
-                  Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col6, _col2
-                  Select Operator [SEL_30] (rows=1 width=20)
-                    Output:["_col2","_col6"]
+                Group By Operator [GBY_34] (rows=1 width=20)
+                  Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
+                  Select Operator [SEL_33] (rows=1 width=20)
+                    Output:["_col1","_col4"]
                     Filter Operator [FIL_29] (rows=1 width=20)
-                      predicate:(((_col1 + _col4) >= 0) and ((_col1 > 0) or (_col6 >= 0)) and ((_col6 >= 1) or (_col2 >= 1)) and ((UDFToLong(_col6) + _col2) >= 0))
-                      Merge Join Operator [MERGEJOIN_42] (rows=4 width=20)
-                        Conds:RS_25._col0=RS_26._col0(Outer),RS_25._col0=RS_27._col0(Right Outer),Output:["_col1","_col2","_col4","_col6"]
-                      <-Map 10 [SIMPLE_EDGE] llap
-                        SHUFFLE [RS_27]
+                      predicate:(((_col3 + _col6) >= 0) and ((UDFToLong(_col1) + _col4) >= 0) and ((_col1 >= 1) or (_col4 >= 1)) and ((_col3 > 0) or (_col1 >= 0)))
+                      Merge Join Operator [MERGEJOIN_50] (rows=3 width=20)
+                        Conds:RS_25._col0=RS_26._col0(Inner),RS_26._col0=RS_27._col0(Inner),Output:["_col1","_col3","_col4","_col6"]
+                      <-Map 1 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_25]
                           PartitionCols:_col0
-                          Select Operator [SEL_24] (rows=20 width=84)
+                          Select Operator [SEL_2] (rows=18 width=84)
                             Output:["_col0","_col1"]
-                            Filter Operator [FIL_41] (rows=20 width=84)
-                              predicate:(c_int > 0)
-                              TableScan [TS_22] (rows=20 width=84)
+                            Filter Operator [FIL_47] (rows=18 width=84)
+                              predicate:((c_int > 0) and key is not null)
+                              TableScan [TS_0] (rows=20 width=84)
                                 default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-                      <-Reducer 3 [SIMPLE_EDGE] llap
-                        SHUFFLE [RS_25]
+                      <-Reducer 10 [SIMPLE_EDGE] llap
+                        SHUFFLE [RS_27]
                           PartitionCols:_col0
-                          Select Operator [SEL_9] (rows=1 width=97)
-                            Output:["_col0","_col1","_col2"]
-                          <-Reducer 2 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_8]
-                              Select Operator [SEL_6] (rows=1 width=105)
+                          Select Operator [SEL_23] (rows=1 width=89)
+                            Output:["_col0","_col1"]
+                          <-Reducer 9 [SIMPLE_EDGE] llap
+                            SHUFFLE [RS_22]
+                              Select Operator [SEL_20] (rows=1 width=105)
                                 Output:["_col0","_col1","_col2","_col3"]
-                                Group By Operator [GBY_5] (rows=1 width=101)
+                                Group By Operator [GBY_19] (rows=1 width=101)
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                <-Map 1 [SIMPLE_EDGE] llap
-                                  SHUFFLE [RS_4]
+                                <-Map 8 [SIMPLE_EDGE] llap
+                                  SHUFFLE [RS_18]
                                     PartitionCols:_col0, _col1, _col2
-                                    Group By Operator [GBY_3] (rows=1 width=101)
+                                    Group By Operator [GBY_17] (rows=1 width=101)
                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                      Filter Operator [FIL_39] (rows=2 width=93)
-                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0))
-                                        TableScan [TS_0] (rows=20 width=88)
-                                          default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                      <-Reducer 9 [SIMPLE_EDGE] llap
+                                      Filter Operator [FIL_49] (rows=2 width=93)
+                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                        TableScan [TS_14] (rows=20 width=88)
+                                          default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                      <-Reducer 7 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_26]
                           PartitionCols:_col0
-                          Select Operator [SEL_20] (rows=1 width=89)
-                            Output:["_col0","_col1"]
-                          <-Reducer 8 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_19]
-                              Select Operator [SEL_17] (rows=1 width=105)
+                          Select Operator [SEL_12] (rows=1 width=97)
+                            Output:["_col0","_col1","_col2"]
+                          <-Reducer 6 [SIMPLE_EDGE] llap
+                            SHUFFLE [RS_11]
+                              Select Operator [SEL_9] (rows=1 width=105)
                                 Output:["_col0","_col1","_col2","_col3"]
-                                Group By Operator [GBY_16] (rows=1 width=101)
+                                Group By Operator [GBY_8] (rows=1 width=101)
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                <-Map 7 [SIMPLE_EDGE] llap
-                                  SHUFFLE [RS_15]
+                                <-Map 5 [SIMPLE_EDGE] llap
+                                  SHUFFLE [RS_7]
                                     PartitionCols:_col0, _col1, _col2
-                                    Group By Operator [GBY_14] (rows=1 width=101)
+                                    Group By Operator [GBY_6] (rows=1 width=101)
                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                      Filter Operator [FIL_40] (rows=2 width=93)
-                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0))
-                                        TableScan [TS_11] (rows=20 width=88)
-                                          default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                                      Filter Operator [FIL_48] (rows=2 width=93)
+                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                        TableScan [TS_3] (rows=20 width=88)
+                                          default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select cbo_t3.c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1 where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)  group by c_float, cbo_t1.c_int, key having cbo_t1.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) cbo_t1 join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2 where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)  group by c_float, cbo_t2.c_int, key having cbo_t2.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0) cbo_t2 on cbo_t1.a=p join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q >= 0) and (b > 0 or c_int >= 0) group by cbo_t3.c_int, c
 PREHOOK: type: QUERY
@@ -704,83 +684,71 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE)
-Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
-Reducer 4 <- Map 8 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
-Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+Reducer 5 <- Map 4 (SIMPLE_EDGE)
 Reducer 7 <- Map 6 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 5 llap
-      File Output Operator [FS_33]
-        Select Operator [SEL_32] (rows=1 width=20)
-          Output:["_col0","_col1","_col2"]
-          Group By Operator [GBY_31] (rows=1 width=20)
-            Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
-          <-Reducer 4 [SIMPLE_EDGE] llap
-            SHUFFLE [RS_30]
-              PartitionCols:_col0, _col1
-              Group By Operator [GBY_29] (rows=1 width=20)
-                Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col2, _col6
-                Select Operator [SEL_28] (rows=3 width=16)
-                  Output:["_col2","_col6"]
-                  Filter Operator [FIL_27] (rows=3 width=16)
-                    predicate:((_col1 > 0) or (_col6 >= 0))
-                    Merge Join Operator [MERGEJOIN_43] (rows=3 width=16)
-                      Conds:RS_24._col0=RS_25._col0(Inner),Output:["_col1","_col2","_col6"]
-                    <-Map 8 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_25]
-                        PartitionCols:_col0
-                        Select Operator [SEL_23] (rows=18 width=84)
-                          Output:["_col0","_col1"]
-                          Filter Operator [FIL_41] (rows=18 width=84)
-                            predicate:key is not null
-                            TableScan [TS_21] (rows=20 width=84)
-                              default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-                    <-Reducer 3 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_24]
-                        PartitionCols:_col0
-                        Select Operator [SEL_20] (rows=1 width=101)
-                          Output:["_col0","_col1","_col2"]
-                          Filter Operator [FIL_19] (rows=1 width=101)
-                            predicate:((_col1 + _col4) >= 0)
-                            Merge Join Operator [MERGEJOIN_42] (rows=1 width=101)
-                              Conds:RS_16._col0=RS_17._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
-                            <-Reducer 2 [SIMPLE_EDGE] llap
-                              SHUFFLE [RS_16]
-                                PartitionCols:_col0
-                                Select Operator [SEL_6] (rows=1 width=97)
-                                  Output:["_col0","_col1","_col2"]
-                                  Group By Operator [GBY_5] (rows=1 width=101)
-                                    Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                  <-Map 1 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_4]
-                                      PartitionCols:_col0, _col1, _col2
-                                      Group By Operator [GBY_3] (rows=1 width=101)
-                                        Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                        Filter Operator [FIL_39] (rows=2 width=93)
-                                          predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0) and key is not null)
-                                          TableScan [TS_0] (rows=20 width=88)
-                                            default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                            <-Reducer 7 [SIMPLE_EDGE] llap
-                              SHUFFLE [RS_17]
-                                PartitionCols:_col0
-                                Select Operator [SEL_14] (rows=1 width=89)
-                                  Output:["_col0","_col1"]
-                                  Group By Operator [GBY_13] (rows=1 width=93)
-                                    Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
-                                  <-Map 6 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_12]
-                                      PartitionCols:_col0, _col1, _col2
-                                      Group By Operator [GBY_11] (rows=1 width=93)
-                                        Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
-                                        Filter Operator [FIL_40] (rows=2 width=93)
-                                          predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0) and key is not null)
-                                          TableScan [TS_8] (rows=20 width=88)
-                                            default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+      Reducer 3 llap
+      File Output Operator [FS_30]
+        Group By Operator [GBY_28] (rows=1 width=20)
+          Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
+        <-Reducer 2 [SIMPLE_EDGE] llap
+          SHUFFLE [RS_27]
+            PartitionCols:_col0, _col1
+            Group By Operator [GBY_26] (rows=1 width=20)
+              Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
+              Select Operator [SEL_25] (rows=1 width=20)
+                Output:["_col1","_col4"]
+                Filter Operator [FIL_23] (rows=1 width=20)
+                  predicate:(((_col3 + _col6) >= 0) and ((_col3 > 0) or (_col1 >= 0)))
+                  Merge Join Operator [MERGEJOIN_40] (rows=3 width=20)
+                    Conds:RS_19._col0=RS_20._col0(Inner),RS_20._col0=RS_21._col0(Inner),Output:["_col1","_col3","_col4","_col6"]
+                  <-Map 1 [SIMPLE_EDGE] llap
+                    SHUFFLE [RS_19]
+                      PartitionCols:_col0
+                      Select Operator [SEL_2] (rows=18 width=84)
+                        Output:["_col0","_col1"]
+                        Filter Operator [FIL_37] (rows=18 width=84)
+                          predicate:key is not null
+                          TableScan [TS_0] (rows=20 width=84)
+                            default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
+                  <-Reducer 5 [SIMPLE_EDGE] llap
+                    SHUFFLE [RS_20]
+                      PartitionCols:_col0
+                      Select Operator [SEL_9] (rows=1 width=97)
+                        Output:["_col0","_col1","_col2"]
+                        Group By Operator [GBY_8] (rows=1 width=101)
+                          Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                        <-Map 4 [SIMPLE_EDGE] llap
+                          SHUFFLE [RS_7]
+                            PartitionCols:_col0, _col1, _col2
+                            Group By Operator [GBY_6] (rows=1 width=101)
+                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                              Filter Operator [FIL_38] (rows=2 width=93)
+                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                TableScan [TS_3] (rows=20 width=88)
+                                  default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                  <-Reducer 7 [SIMPLE_EDGE] llap
+                    SHUFFLE [RS_21]
+                      PartitionCols:_col0
+                      Select Operator [SEL_17] (rows=1 width=89)
+                        Output:["_col0","_col1"]
+                        Group By Operator [GBY_16] (rows=1 width=93)
+                          Output:["_col0","_col1","_col2"],keys:KEY._col0, KEY._col1, KEY._col2
+                        <-Map 6 [SIMPLE_EDGE] llap
+                          SHUFFLE [RS_15]
+                            PartitionCols:_col0, _col1, _col2
+                            Group By Operator [GBY_14] (rows=1 width=93)
+                              Output:["_col0","_col1","_col2"],keys:key, c_int, c_float
+                              Filter Operator [FIL_39] (rows=2 width=93)
+                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and key is not null)
+                                TableScan [TS_11] (rows=20 width=88)
+                                  default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select unionsrc.key FROM (select 'tst1' as key, count(1) as value from src) unionsrc
 PREHOOK: type: QUERY
@@ -1155,55 +1123,47 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 4 (SIMPLE_EDGE)
-Reducer 3 <- Map 5 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (SIMPLE_EDGE), Map 4 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 3 llap
-      File Output Operator [FS_19]
-        Select Operator [SEL_18] (rows=36 width=101)
+      Reducer 2 llap
+      File Output Operator [FS_16]
+        Select Operator [SEL_15] (rows=72 width=101)
           Output:["_col0","_col1","_col2","_col3","_col4"]
-          Filter Operator [FIL_17] (rows=36 width=101)
-            predicate:((_col1 > 0) or (_col6 >= 0))
-            Merge Join Operator [MERGEJOIN_28] (rows=36 width=101)
-              Conds:RS_14._col0=RS_15._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6"]
-            <-Map 5 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_15]
+          Filter Operator [FIL_13] (rows=72 width=101)
+            predicate:(((_col1 > 0) or (_col6 >= 0)) and ((_col1 + _col4) = 2))
+            Merge Join Operator [MERGEJOIN_26] (rows=145 width=101)
+              Conds:RS_9._col0=RS_10._col0(Inner),RS_9._col0=RS_11._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6"]
+            <-Map 1 [SIMPLE_EDGE] llap
+              SHUFFLE [RS_9]
+                PartitionCols:_col0
+                Select Operator [SEL_2] (rows=9 width=93)
+                  Output:["_col0","_col1","_col2"]
+                  Filter Operator [FIL_23] (rows=9 width=93)
+                    predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)) and key is not null)
+                    TableScan [TS_0] (rows=20 width=88)
+                      default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+            <-Map 3 [SIMPLE_EDGE] llap
+              SHUFFLE [RS_10]
+                PartitionCols:_col0
+                Select Operator [SEL_5] (rows=9 width=89)
+                  Output:["_col0","_col1"]
+                  Filter Operator [FIL_24] (rows=9 width=93)
+                    predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)) and key is not null)
+                    TableScan [TS_3] (rows=20 width=88)
+                      default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+            <-Map 4 [SIMPLE_EDGE] llap
+              SHUFFLE [RS_11]
                 PartitionCols:_col0
-                Select Operator [SEL_13] (rows=18 width=84)
+                Select Operator [SEL_8] (rows=18 width=84)
                   Output:["_col0","_col1"]
-                  Filter Operator [FIL_26] (rows=18 width=84)
+                  Filter Operator [FIL_25] (rows=18 width=84)
                     predicate:key is not null
-                    TableScan [TS_11] (rows=20 width=84)
+                    TableScan [TS_6] (rows=20 width=84)
                       default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-            <-Reducer 2 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_14]
-                PartitionCols:_col0
-                Filter Operator [FIL_9] (rows=10 width=182)
-                  predicate:(((_col1 + _col4) = 2) and ((_col4 + 1) = 2))
-                  Merge Join Operator [MERGEJOIN_27] (rows=40 width=182)
-                    Conds:RS_6._col0=RS_7._col0(Left Outer),Output:["_col0","_col1","_col2","_col3","_col4"]
-                  <-Map 1 [SIMPLE_EDGE] llap
-                    SHUFFLE [RS_6]
-                      PartitionCols:_col0
-                      Select Operator [SEL_2] (rows=9 width=93)
-                        Output:["_col0","_col1","_col2"]
-                        Filter Operator [FIL_24] (rows=9 width=93)
-                          predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)) and key is not null)
-                          TableScan [TS_0] (rows=20 width=88)
-                            default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                  <-Map 4 [SIMPLE_EDGE] llap
-                    SHUFFLE [RS_7]
-                      PartitionCols:_col0
-                      Select Operator [SEL_5] (rows=9 width=89)
-                        Output:["_col0","_col1"]
-                        Filter Operator [FIL_25] (rows=9 width=93)
-                          predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)) and key is not null)
-                          TableScan [TS_3] (rows=20 width=88)
-                            default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select * from (select q, b, cbo_t2.p, cbo_t1.c, cbo_t3.c_int from (select key as a, c_int as b, cbo_t1.c_float as c from cbo_t1  where (cbo_t1.c_int + 1 == 2) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)) cbo_t1 right outer join (select cbo_t2.key as p, cbo_t2.c_int as q, c_float as r from cbo_t2  where (cbo_t2.c_int + 1 == 2) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)) cbo_t2 on cbo_t1.a=p right outer join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q == 2) and (b > 0 or c_int >= 0)) R where  (q + 1 = 2) and (R.b > 0 or c_int >= 0)
 PREHOOK: type: QUERY
@@ -1219,38 +1179,40 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 2 llap
-      File Output Operator [FS_14]
-        Select Operator [SEL_13] (rows=50 width=101)
+      File Output Operator [FS_16]
+        Select Operator [SEL_15] (rows=72 width=101)
           Output:["_col0","_col1","_col2","_col3","_col4"]
-          Filter Operator [FIL_12] (rows=50 width=101)
-            predicate:(((_col1 + _col4) = 2) and ((_col1 > 0) or (_col6 >= 0)) and ((_col4 + 1) = 2))
-            Merge Join Operator [MERGEJOIN_19] (rows=200 width=101)
-              Conds:RS_8._col0=RS_9._col0(Right Outer),RS_8._col0=RS_10._col0(Right Outer),Output:["_col1","_col2","_col3","_col4","_col6"]
+          Filter Operator [FIL_13] (rows=72 width=101)
+            predicate:(((_col1 > 0) or (_col6 >= 0)) and ((_col1 + _col4) = 2))
+            Merge Join Operator [MERGEJOIN_26] (rows=145 width=101)
+              Conds:RS_9._col0=RS_10._col0(Inner),RS_9._col0=RS_11._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6"]
             <-Map 1 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_8]
+              SHUFFLE [RS_9]
                 PartitionCols:_col0
-                Select Operator [SEL_2] (rows=10 width=93)
+                Select Operator [SEL_2] (rows=9 width=93)
                   Output:["_col0","_col1","_col2"]
-                  Filter Operator [FIL_17] (rows=10 width=93)
-                    predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)))
+                  Filter Operator [FIL_23] (rows=9 width=93)
+                    predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)) and key is not null)
                     TableScan [TS_0] (rows=20 width=88)
                       default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
             <-Map 3 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_9]
+              SHUFFLE [RS_10]
                 PartitionCols:_col0
-                Select Operator [SEL_5] (rows=10 width=89)
+                Select Operator [SEL_5] (rows=9 width=89)
                   Output:["_col0","_col1"]
-                  Filter Operator [FIL_18] (rows=10 width=93)
-                    predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)))
+                  Filter Operator [FIL_24] (rows=9 width=93)
+                    predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0)) and key is not null)
                     TableScan [TS_3] (rows=20 width=88)
                       default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
             <-Map 4 [SIMPLE_EDGE] llap
-              SHUFFLE [RS_10]
+              SHUFFLE [RS_11]
                 PartitionCols:_col0
-                Select Operator [SEL_7] (rows=20 width=84)
+                Select Operator [SEL_8] (rows=18 width=84)
                   Output:["_col0","_col1"]
-                  TableScan [TS_6] (rows=20 width=84)
-                    default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
+                  Filter Operator [FIL_25] (rows=18 width=84)
+                    predicate:key is not null
+                    TableScan [TS_6] (rows=20 width=84)
+                      default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
 
 PREHOOK: query: explain select key, (c_int+1)+2 as x, sum(c_int) from cbo_t1 group by c_float, cbo_t1.c_int, key order by x limit 1
 PREHOOK: type: QUERY
@@ -1418,108 +1380,98 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Reducer 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
-Reducer 5 <- Map 11 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 4 <- Map 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
-Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
-Reducer 9 <- Map 8 (SIMPLE_EDGE)
+Reducer 8 <- Map 7 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:5
     Stage-1
-      Reducer 7 llap
-      File Output Operator [FS_49]
-        Limit [LIM_48] (rows=1 width=20)
+      Reducer 6 llap
+      File Output Operator [FS_45]
+        Limit [LIM_44] (rows=1 width=20)
           Number of rows:5
-          Select Operator [SEL_47] (rows=1 width=20)
+          Select Operator [SEL_43] (rows=1 width=20)
             Output:["_col0","_col1","_col2"]
-          <-Reducer 6 [SIMPLE_EDGE] llap
-            SHUFFLE [RS_46]
-              Select Operator [SEL_44] (rows=1 width=20)
+          <-Reducer 5 [SIMPLE_EDGE] llap
+            SHUFFLE [RS_42]
+              Select Operator [SEL_41] (rows=1 width=20)
                 Output:["_col0","_col1","_col2"]
-                Group By Operator [GBY_43] (rows=1 width=20)
+                Group By Operator [GBY_40] (rows=1 width=20)
                   Output:["_col0","_col1","_col2"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1
-                <-Reducer 5 [SIMPLE_EDGE] llap
-                  SHUFFLE [RS_42]
+                <-Reducer 4 [SIMPLE_EDGE] llap
+                  SHUFFLE [RS_39]
                     PartitionCols:_col0, _col1
-                    Group By Operator [GBY_41] (rows=1 width=20)
-                      Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col2, _col6
-                      Select Operator [SEL_40] (rows=3 width=16)
-                        Output:["_col2","_col6"]
-                        Filter Operator [FIL_39] (rows=3 width=16)
-                          predicate:((_col1 > 0) or (_col6 >= 0))
-                          Merge Join Operator [MERGEJOIN_61] (rows=3 width=16)
-                            Conds:RS_36._col0=RS_37._col0(Inner),Output:["_col1","_col2","_col6"]
-                          <-Map 11 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_37]
+                    Group By Operator [GBY_38] (rows=1 width=20)
+                      Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col4, _col6
+                      Select Operator [SEL_37] (rows=3 width=20)
+                        Output:["_col4","_col6"]
+                        Filter Operator [FIL_35] (rows=3 width=20)
+                          predicate:(((_col3 > 0) or (_col6 >= 0)) and ((_col3 + _col1) >= 0))
+                          Merge Join Operator [MERGEJOIN_57] (rows=7 width=20)
+                            Conds:RS_31._col0=RS_32._col0(Inner),RS_32._col0=RS_33._col0(Inner),Output:["_col1","_col3","_col4","_col6"]
+                          <-Map 10 [SIMPLE_EDGE] llap
+                            SHUFFLE [RS_33]
                               PartitionCols:_col0
-                              Select Operator [SEL_35] (rows=18 width=84)
+                              Select Operator [SEL_30] (rows=18 width=84)
                                 Output:["_col0","_col1"]
-                                Filter Operator [FIL_59] (rows=18 width=84)
+                                Filter Operator [FIL_56] (rows=18 width=84)
                                   predicate:key is not null
-                                  TableScan [TS_33] (rows=20 width=84)
+                                  TableScan [TS_28] (rows=20 width=84)
                                     default@cbo_t3,cbo_t3,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int"]
-                          <-Reducer 4 [SIMPLE_EDGE] llap
-                            SHUFFLE [RS_36]
+                          <-Reducer 3 [SIMPLE_EDGE] llap
+                            SHUFFLE [RS_31]
                               PartitionCols:_col0
-                              Select Operator [SEL_32] (rows=1 width=101)
-                                Output:["_col0","_col1","_col2"]
-                                Filter Operator [FIL_31] (rows=1 width=101)
-                                  predicate:((_col1 + _col4) >= 0)
-                                  Merge Join Operator [MERGEJOIN_60] (rows=2 width=101)
-                                    Conds:RS_28._col0=RS_29._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
-                                  <-Reducer 10 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_29]
-                                      PartitionCols:_col0
-                                      Filter Operator [FIL_26] (rows=2 width=105)
-                                        predicate:_col0 is not null
-                                        Limit [LIM_24] (rows=3 width=105)
-                                          Number of rows:5
-                                          Select Operator [SEL_23] (rows=3 width=105)
-                                            Output:["_col0","_col1"]
-                                          <-Reducer 9 [SIMPLE_EDGE] llap
-                                            SHUFFLE [RS_22]
-                                              Select Operator [SEL_20] (rows=3 width=105)
-                                                Output:["_col0","_col1","_col2","_col3"]
-                                                Group By Operator [GBY_19] (rows=3 width=101)
-                                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                                <-Map 8 [SIMPLE_EDGE] llap
-                                                  SHUFFLE [RS_18]
-                                                    PartitionCols:_col0, _col1, _col2
-                                                    Group By Operator [GBY_17] (rows=3 width=101)
-                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                                      Filter Operator [FIL_58] (rows=6 width=93)
-                                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)))
-                                                        TableScan [TS_14] (rows=20 width=88)
-                                                          default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
-                                  <-Reducer 3 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_28]
-                                      PartitionCols:_col0
-                                      Filter Operator [FIL_12] (rows=2 width=97)
-                                        predicate:_col0 is not null
-                                        Limit [LIM_10] (rows=3 width=97)
-                                          Number of rows:5
-                                          Select Operator [SEL_9] (rows=3 width=97)
-                                            Output:["_col0","_col1","_col2"]
-                                          <-Reducer 2 [SIMPLE_EDGE] llap
-                                            SHUFFLE [RS_8]
-                                              Select Operator [SEL_6] (rows=3 width=97)
-                                                Output:["_col0","_col1","_col2"]
-                                                Group By Operator [GBY_5] (rows=3 width=101)
-                                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                                <-Map 1 [SIMPLE_EDGE] llap
-                                                  SHUFFLE [RS_4]
-                                                    PartitionCols:_col0, _col1, _col2
-                                                    Group By Operator [GBY_3] (rows=3 width=101)
-                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                                      Filter Operator [FIL_56] (rows=6 width=93)
-                                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)))
-                                                        TableScan [TS_0] (rows=20 width=88)
-                                                          default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                              Filter Operator [FIL_12] (rows=2 width=105)
+                                predicate:_col0 is not null
+                                Limit [LIM_10] (rows=3 width=105)
+                                  Number of rows:5
+                                  Select Operator [SEL_9] (rows=3 width=105)
+                                    Output:["_col0","_col1"]
+                                  <-Reducer 2 [SIMPLE_EDGE] llap
+                                    SHUFFLE [RS_8]
+                                      Select Operator [SEL_6] (rows=3 width=105)
+                                        Output:["_col0","_col1","_col2","_col3"]
+                                        Group By Operator [GBY_5] (rows=3 width=101)
+                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                                        <-Map 1 [SIMPLE_EDGE] llap
+                                          SHUFFLE [RS_4]
+                                            PartitionCols:_col0, _col1, _col2
+                                            Group By Operator [GBY_3] (rows=3 width=101)
+                                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                              Filter Operator [FIL_53] (rows=6 width=93)
+                                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)))
+                                                TableScan [TS_0] (rows=20 width=88)
+                                                  default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                          <-Reducer 9 [SIMPLE_EDGE] llap
+                            SHUFFLE [RS_32]
+                              PartitionCols:_col0
+                              Filter Operator [FIL_26] (rows=2 width=97)
+                                predicate:_col0 is not null
+                                Limit [LIM_24] (rows=3 width=97)
+                                  Number of rows:5
+                                  Select Operator [SEL_23] (rows=3 width=97)
+                                    Output:["_col0","_col1","_col2"]
+                                  <-Reducer 8 [SIMPLE_EDGE] llap
+                                    SHUFFLE [RS_22]
+                                      Select Operator [SEL_20] (rows=3 width=97)
+                                        Output:["_col0","_col1","_col2"]
+                                        Group By Operator [GBY_19] (rows=3 width=101)
+                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                                        <-Map 7 [SIMPLE_EDGE] llap
+                                          SHUFFLE [RS_18]
+                                            PartitionCols:_col0, _col1, _col2
+                                            Group By Operator [GBY_17] (rows=3 width=101)
+                                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                              Filter Operator [FIL_55] (rows=6 width=93)
+                                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)))
+                                                TableScan [TS_14] (rows=20 width=88)
+                                                  default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select cbo_t1.c_int           from cbo_t1 left semi join   cbo_t2 on cbo_t1.key=cbo_t2.key where (cbo_t1.c_int + 1 == 2) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)
 PREHOOK: type: QUERY
@@ -1680,7 +1632,7 @@ Stage-0
                                       Group By Operator [GBY_3] (rows=1 width=101)
                                         Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                         Filter Operator [FIL_48] (rows=1 width=93)
-                                          predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0) and (((c_int + 1) + 1) >= 0) and (((c_int + 1) > 0) or (UDFToDouble(key) >= 0.0)) and (UDFToDouble(key) > 0.0))
+                                          predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and (((c_int + 1) + 1) >= 0) and (((c_int + 1) > 0) or (UDFToDouble(key) >= 0.0)) and (UDFToDouble(key) > 0.0))
                                           TableScan [TS_0] (rows=20 width=88)
                                             default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
                     <-Reducer 9 [SIMPLE_EDGE] llap
@@ -1702,7 +1654,7 @@ Stage-0
                                     Group By Operator [GBY_15] (rows=1 width=101)
                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
                                       Filter Operator [FIL_49] (rows=1 width=93)
-                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0.0) and (UDFToDouble(key) > 0.0))
+                                        predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0)) and (c_float > 0) and ((c_int >= 1) or (c_float >= 1)) and ((UDFToFloat(c_int) + c_float) >= 0) and (UDFToDouble(key) > 0.0))
                                         TableScan [TS_12] (rows=20 width=88)
                                           default@cbo_t2,cbo_t2,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
@@ -2430,10 +2382,10 @@ Stage-0
             <-Reducer 7 [SIMPLE_EDGE] llap
               SHUFFLE [RS_22]
                 PartitionCols:_col0, _col1
-                Select Operator [SEL_17] (rows=1 width=223)
+                Select Operator [SEL_17] (rows=2 width=223)
                   Output:["_col0","_col1","_col2"]
-                  Filter Operator [FIL_16] (rows=1 width=219)
-                    predicate:(_col0 = _col0)
+                  Filter Operator [FIL_16] (rows=2 width=219)
+                    predicate:_col0 is not null
                     Group By Operator [GBY_14] (rows=2 width=219)
                       Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                     <-Map 6 [SIMPLE_EDGE] llap
@@ -2468,41 +2420,40 @@ Plan optimized by CBO.
 
 Vertex dependency in root stage
 Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Reducer 6 (CUSTOM_SIMPLE_EDGE)
-Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
 Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 Reducer 6 <- Map 5 (CUSTOM_SIMPLE_EDGE)
 Reducer 8 <- Map 7 (CUSTOM_SIMPLE_EDGE)
-Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:-1
     Stage-1
       Reducer 4 llap
-      File Output Operator [FS_36]
-        Select Operator [SEL_35] (rows=26 width=125)
+      File Output Operator [FS_31]
+        Select Operator [SEL_30] (rows=26 width=125)
           Output:["_col0","_col1"]
         <-Reducer 3 [SIMPLE_EDGE] llap
-          SHUFFLE [RS_34]
-            Select Operator [SEL_33] (rows=26 width=125)
+          SHUFFLE [RS_29]
+            Select Operator [SEL_28] (rows=26 width=125)
               Output:["_col0","_col1"]
-              Filter Operator [FIL_32] (rows=26 width=145)
+              Filter Operator [FIL_27] (rows=26 width=145)
                 predicate:((_col2 = 0) or (_col5 is null and _col1 is not null and (_col3 >= _col2)))
-                Merge Join Operator [MERGEJOIN_42] (rows=26 width=145)
-                  Conds:RS_29.UDFToDouble(_col1)=RS_30._col0(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5"]
+                Merge Join Operator [MERGEJOIN_37] (rows=26 width=145)
+                  Conds:RS_24.UDFToDouble(_col1)=RS_25._col0(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5"]
                 <-Reducer 2 [SIMPLE_EDGE] llap
-                  SHUFFLE [RS_29]
+                  SHUFFLE [RS_24]
                     PartitionCols:UDFToDouble(_col1)
-                    Merge Join Operator [MERGEJOIN_41] (rows=26 width=141)
+                    Merge Join Operator [MERGEJOIN_36] (rows=26 width=141)
                       Conds:(Inner),Output:["_col0","_col1","_col2","_col3"]
                     <-Map 1 [CUSTOM_SIMPLE_EDGE] llap
-                      PARTITION_ONLY_SHUFFLE [RS_26]
+                      PARTITION_ONLY_SHUFFLE [RS_21]
                         Select Operator [SEL_1] (rows=26 width=125)
                           Output:["_col0","_col1"]
                           TableScan [TS_0] (rows=26 width=125)
                             default@part,part,Tbl:COMPLETE,Col:COMPLETE,Output:["p_name","p_size"]
                     <-Reducer 6 [CUSTOM_SIMPLE_EDGE] llap
-                      PARTITION_ONLY_SHUFFLE [RS_27]
+                      PARTITION_ONLY_SHUFFLE [RS_22]
                         Group By Operator [GBY_12] (rows=1 width=16)
                           Output:["_col0","_col1"],aggregations:["count()","count(_col0)"]
                           Group By Operator [GBY_7] (rows=1 width=8)
@@ -2511,32 +2462,25 @@ Stage-0
                             PARTITION_ONLY_SHUFFLE [RS_6]
                               Group By Operator [GBY_5] (rows=1 width=76)
                                 Output:["_col0"],aggregations:["avg(p_size)"]
-                                Filter Operator [FIL_38] (rows=8 width=4)
+                                Filter Operator [FIL_33] (rows=8 width=4)
                                   predicate:(p_size < 10)
                                   TableScan [TS_2] (rows=26 width=4)
                                     default@part,part,Tbl:COMPLETE,Col:COMPLETE,Output:["p_size"]
-                <-Reducer 9 [SIMPLE_EDGE] llap
-                  SHUFFLE [RS_30]
+                <-Reducer 8 [SIMPLE_EDGE] llap
+                  SHUFFLE [RS_25]
                     PartitionCols:_col0
-                    Select Operator [SEL_25] (rows=1 width=12)
+                    Select Operator [SEL_20] (rows=1 width=12)
                       Output:["_col0","_col1"]
-                      Group By Operator [GBY_24] (rows=1 width=8)
-                        Output:["_col0"],keys:KEY._col0
-                      <-Reducer 8 [SIMPLE_EDGE] llap
-                        SHUFFLE [RS_23]
-                          PartitionCols:_col0
-                          Group By Operator [GBY_22] (rows=1 width=8)
-                            Output:["_col0"],keys:_col0
-                            Group By Operator [GBY_19] (rows=1 width=8)
-                              Output:["_col0"],aggregations:["avg(VALUE._col0)"]
-                            <-Map 7 [CUSTOM_SIMPLE_EDGE] llap
-                              PARTITION_ONLY_SHUFFLE [RS_18]
-                                Group By Operator [GBY_17] (rows=1 width=76)
-                                  Output:["_col0"],aggregations:["avg(p_size)"]
-                                  Filter Operator [FIL_40] (rows=8 width=4)
-                                    predicate:(p_size < 10)
-                                    TableScan [TS_14] (rows=26 width=4)
-                                      default@part,part,Tbl:COMPLETE,Col:COMPLETE,Output:["p_size"]
+                      Group By Operator [GBY_19] (rows=1 width=8)
+                        Output:["_col0"],aggregations:["avg(VALUE._col0)"]
+                      <-Map 7 [CUSTOM_SIMPLE_EDGE] llap
+                        PARTITION_ONLY_SHUFFLE [RS_18]
+                          Group By Operator [GBY_17] (rows=1 width=76)
+                            Output:["_col0"],aggregations:["avg(p_size)"]
+                            Filter Operator [FIL_35] (rows=8 width=4)
+                              predicate:(p_size < 10)
+                              TableScan [TS_14] (rows=26 width=4)
+                                default@part,part,Tbl:COMPLETE,Col:COMPLETE,Output:["p_size"]
 
 PREHOOK: query: explain select b.p_mfgr, min(p_retailprice) 
 from part b 
@@ -2562,10 +2506,9 @@ Plan optimized by CBO.
 
 Vertex dependency in root stage
 Reducer 10 <- Map 9 (SIMPLE_EDGE)
-Reducer 11 <- Reducer 10 (SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
-Reducer 4 <- Reducer 11 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 Reducer 7 <- Map 6 (SIMPLE_EDGE)
 Reducer 8 <- Reducer 7 (SIMPLE_EDGE)
@@ -2575,51 +2518,44 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 5 llap
-      File Output Operator [FS_42]
-        Select Operator [SEL_41] (rows=3 width=106)
+      File Output Operator [FS_37]
+        Select Operator [SEL_36] (rows=3 width=106)
           Output:["_col0","_col1"]
         <-Reducer 4 [SIMPLE_EDGE] llap
-          SHUFFLE [RS_40]
-            Select Operator [SEL_39] (rows=3 width=106)
+          SHUFFLE [RS_35]
+            Select Operator [SEL_34] (rows=3 width=106)
               Output:["_col0","_col1"]
-              Filter Operator [FIL_38] (rows=3 width=126)
+              Filter Operator [FIL_33] (rows=3 width=126)
                 predicate:(not CASE WHEN ((_col3 = 0)) THEN (false) WHEN (_col3 is null) THEN (false) WHEN (_col7 is not null) THEN (true) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (true) ELSE (false) END)
-                Merge Join Operator [MERGEJOIN_49] (rows=5 width=126)
-                  Conds:RS_35._col0, _col1=RS_36._col0, _col1(Left Outer),Output:["_col0","_col1","_col3","_col4","_col7"]
-                <-Reducer 11 [SIMPLE_EDGE] llap
-                  SHUFFLE [RS_36]
+                Merge Join Operator [MERGEJOIN_44] (rows=5 width=126)
+                  Conds:RS_30._col0, _col1=RS_31._col0, _col1(Left Outer),Output:["_col0","_col1","_col3","_col4","_col7"]
+                <-Reducer 10 [SIMPLE_EDGE] llap
+                  SHUFFLE [RS_31]
                     PartitionCols:_col0, _col1
-                    Select Operator [SEL_31] (rows=1 width=110)
+                    Select Operator [SEL_26] (rows=1 width=110)
                       Output:["_col0","_col1","_col2"]
-                      Filter Operator [FIL_30] (rows=1 width=106)
-                        predicate:(_col0 = _col0)
-                        Group By Operator [GBY_28] (rows=1 width=106)
-                          Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
-                        <-Reducer 10 [SIMPLE_EDGE] llap
-                          SHUFFLE [RS_27]
-                            PartitionCols:_col0, _col1
-                            Group By Operator [GBY_26] (rows=1 width=106)
-                              Output:["_col0","_col1"],keys:_col0, _col1
-                              Select Operator [SEL_24] (rows=1 width=114)
-                                Output:["_col0","_col1"]
-                                Filter Operator [FIL_46] (rows=1 width=114)
-                                  predicate:((_col1 = _col1) and ((_col2 - _col1) > 600.0))
-                                  Group By Operator [GBY_22] (rows=5 width=114)
-                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)"],keys:KEY._col0
-                                  <-Map 9 [SIMPLE_EDGE] llap
-                                    SHUFFLE [RS_21]
-                                      PartitionCols:_col0
-                                      Group By Operator [GBY_20] (rows=5 width=114)
-                                        Output:["_col0","_col1","_col2"],aggregations:["min(p_retailprice)","max(p_retailprice)"],keys:p_mfgr
-                                        TableScan [TS_18] (rows=26 width=106)
-                                          default@part,part,Tbl:COMPLETE,Col:COMPLETE,Output:["p_mfgr","p_retailprice"]
+                      Filter Operator [FIL_25] (rows=1 width=110)
+                        predicate:_col0 is not null
+                        Select Operator [SEL_24] (rows=1 width=110)
+                          Output:["_col0","_col1"]
+                          Filter Operator [FIL_41] (rows=1 width=114)
+                            predicate:((_col1 = _col1) and ((_col2 - _col1) > 600.0))
+                            Group By Operator [GBY_22] (rows=5 width=114)
+                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)"],keys:KEY._col0
+                            <-Map 9 [SIMPLE_EDGE] llap
+                              SHUFFLE [RS_21]
+                                PartitionCols:_col0
+                                Group By Operator [GBY_20] (rows=5 width=114)
+                                  Output:["_col0","_col1","_col2"],aggregations:["min(p_retailprice)","max(p_retailprice)"],keys:p_mfgr
+                                  TableScan [TS_18] (rows=26 width=106)
+                                    default@part,part,Tbl:COMPLETE,Col:COMPLETE,Output:["p_mfgr","p_retailprice"]
                 <-Reducer 3 [SIMPLE_EDGE] llap
-                  SHUFFLE [RS_35]
+                  SHUFFLE [RS_30]
                     PartitionCols:_col0, _col1
-                    Merge Join Operator [MERGEJOIN_48] (rows=5 width=122)
-                      Conds:RS_32._col1=RS_33._col0(Left Outer),Output:["_col0","_col1","_col3","_col4"]
+                    Merge Join Operator [MERGEJOIN_43] (rows=5 width=122)
+                      Conds:RS_27._col1=RS_28._col0(Left Outer),Output:["_col0","_col1","_col3","_col4"]
                     <-Reducer 2 [SIMPLE_EDGE] llap
-                      SHUFFLE [RS_32]
+                      SHUFFLE [RS_27]
                         PartitionCols:_col1
                         Group By Operator [GBY_4] (rows=5 width=106)
                           Output:["_col0","_col1"],aggregations:["min(VALUE._col0)"],keys:KEY._col0
@@ -2633,7 +2569,7 @@ Sta

<TRUNCATED>