You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2015/08/10 12:37:54 UTC

[1/3] hive git commit: HIVE-9069: Simplify filter predicates for CBO (Jesus Camacho Rodriguez, reviewed by Laljo John Pullokkaran)

Repository: hive
Updated Branches:
  refs/heads/branch-1 14c5e446d -> e2f1caf39


http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/explainuser_1.q.out b/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
index e49f0c8..e689528 100644
--- a/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
+++ b/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
@@ -687,157 +687,154 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 6
-         File Output Operator [FS_42]
+         File Output Operator [FS_45]
             compressed:false
             Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
-            Select Operator [SEL_41]
+            Select Operator [SEL_44]
             |  outputColumnNames:["_col0","_col1","_col2"]
             |  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             |<-Reducer 5 [SIMPLE_EDGE]
-               Reduce Output Operator [RS_40]
+               Reduce Output Operator [RS_43]
                   key expressions:(UDFToLong(_col0) % _col1) (type: bigint), _col0 (type: int)
                   sort order:+-
                   Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions:_col1 (type: bigint), _col2 (type: bigint)
-                  Group By Operator [GBY_38]
+                  Group By Operator [GBY_41]
                   |  aggregations:["count(VALUE._col0)"]
                   |  keys:KEY._col0 (type: int), KEY._col1 (type: bigint)
                   |  outputColumnNames:["_col0","_col1","_col2"]
                   |  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   |<-Reducer 4 [SIMPLE_EDGE]
-                     Reduce Output Operator [RS_37]
+                     Reduce Output Operator [RS_40]
                         key expressions:_col0 (type: int), _col1 (type: bigint)
                         Map-reduce partition columns:_col0 (type: int), _col1 (type: bigint)
                         sort order:++
                         Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions:_col2 (type: bigint)
-                        Group By Operator [GBY_36]
+                        Group By Operator [GBY_39]
                            aggregations:["count()"]
                            keys:_col0 (type: int), _col1 (type: bigint)
                            outputColumnNames:["_col0","_col1","_col2"]
                            Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                           Select Operator [SEL_34]
+                           Select Operator [SEL_35]
                               outputColumnNames:["_col0","_col1"]
                               Statistics:Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                              Filter Operator [FIL_33]
-                                 predicate:(((_col1 > 0) or (_col6 >= 0)) and (((_col6 >= 1) or (_col2 >= 1)) and ((UDFToLong(_col6) + _col2) >= 0))) (type: boolean)
+                              Filter Operator [FIL_49]
+                                 predicate:((((_col6 > 0) and ((_col6 >= 1) or (_col2 >= 1))) and ((UDFToLong(_col6) + _col2) >= 0)) and ((_col1 > 0) or (_col6 >= 0))) (type: boolean)
                                  Statistics:Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                                 Merge Join Operator [MERGEJOIN_52]
-                                 |  condition map:[{"":"Inner Join 0 to 1"}]
+                                 Merge Join Operator [MERGEJOIN_55]
+                                 |  condition map:[{"":"Left Outer Join0 to 1"}]
                                  |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                                  |  outputColumnNames:["_col1","_col2","_col6"]
-                                 |  Statistics:Num rows: 2 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |  Statistics:Num rows: 4 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
                                  |<-Map 10 [SIMPLE_EDGE]
-                                 |  Reduce Output Operator [RS_31]
+                                 |  Reduce Output Operator [RS_32]
                                  |     key expressions:_col0 (type: string)
                                  |     Map-reduce partition columns:_col0 (type: string)
                                  |     sort order:+
-                                 |     Statistics:Num rows: 5 Data size: 356 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |     Statistics:Num rows: 20 Data size: 1602 Basic stats: COMPLETE Column stats: COMPLETE
                                  |     value expressions:_col1 (type: int)
-                                 |     Select Operator [SEL_27]
+                                 |     Select Operator [SEL_30]
                                  |        outputColumnNames:["_col0","_col1"]
-                                 |        Statistics:Num rows: 5 Data size: 356 Basic stats: COMPLETE Column stats: COMPLETE
-                                 |        Filter Operator [FIL_50]
-                                 |           predicate:((c_int > 0) and key is not null) (type: boolean)
-                                 |           Statistics:Num rows: 5 Data size: 356 Basic stats: COMPLETE Column stats: COMPLETE
-                                 |           TableScan [TS_25]
-                                 |              alias:cbo_t3
-                                 |              Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |        Statistics:Num rows: 20 Data size: 1602 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |        TableScan [TS_29]
+                                 |           alias:cbo_t3
+                                 |           Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                                  |<-Reducer 3 [SIMPLE_EDGE]
-                                    Reduce Output Operator [RS_29]
+                                    Reduce Output Operator [RS_31]
                                        key expressions:_col0 (type: string)
                                        Map-reduce partition columns:_col0 (type: string)
                                        sort order:+
                                        Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                        value expressions:_col1 (type: int), _col2 (type: bigint)
-                                       Select Operator [SEL_22]
+                                       Select Operator [SEL_26]
                                           outputColumnNames:["_col0","_col1","_col2"]
                                           Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
-                                          Filter Operator [FIL_47]
+                                          Filter Operator [FIL_50]
                                              predicate:((_col3 + _col1) >= 0) (type: boolean)
                                              Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                             Merge Join Operator [MERGEJOIN_51]
+                                             Merge Join Operator [MERGEJOIN_54]
                                              |  condition map:[{"":"Right Outer Join0 to 1"}]
                                              |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                                              |  outputColumnNames:["_col1","_col2","_col3","_col4"]
                                              |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                              |<-Reducer 2 [SIMPLE_EDGE]
-                                             |  Reduce Output Operator [RS_19]
+                                             |  Reduce Output Operator [RS_23]
                                              |     key expressions:_col0 (type: string)
                                              |     Map-reduce partition columns:_col0 (type: string)
                                              |     sort order:+
                                              |     Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
                                              |     value expressions:_col1 (type: int)
-                                             |     Select Operator [SEL_7]
+                                             |     Select Operator [SEL_9]
                                              |        outputColumnNames:["_col0","_col1"]
                                              |        Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
-                                             |        Group By Operator [GBY_6]
+                                             |        Group By Operator [GBY_8]
                                              |        |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                              |        |  outputColumnNames:["_col0","_col1","_col2"]
                                              |        |  Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                              |        |<-Map 1 [SIMPLE_EDGE]
-                                             |           Reduce Output Operator [RS_5]
+                                             |           Reduce Output Operator [RS_7]
                                              |              key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                              |              Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                              |              sort order:+++
                                              |              Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                             |              Group By Operator [GBY_4]
+                                             |              Group By Operator [GBY_6]
                                              |                 keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                              |                 outputColumnNames:["_col0","_col1","_col2"]
                                              |                 Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                              |                 Select Operator [SEL_2]
                                              |                    outputColumnNames:["_col0","_col1","_col2"]
                                              |                    Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                             |                    Filter Operator [FIL_48]
-                                             |                       predicate:(((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) and key is not null) (type: boolean)
+                                             |                    Filter Operator [FIL_51]
+                                             |                       predicate:((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) (type: boolean)
                                              |                       Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                              |                       TableScan [TS_0]
                                              |                          alias:cbo_t2
                                              |                          Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                                              |<-Reducer 9 [SIMPLE_EDGE]
-                                                Reduce Output Operator [RS_20]
+                                                Reduce Output Operator [RS_24]
                                                    key expressions:_col0 (type: string)
                                                    Map-reduce partition columns:_col0 (type: string)
                                                    sort order:+
                                                    Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                                    value expressions:_col1 (type: int), _col2 (type: bigint)
-                                                   Select Operator [SEL_17]
+                                                   Select Operator [SEL_21]
                                                    |  outputColumnNames:["_col0","_col1","_col2"]
                                                    |  Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                                    |<-Reducer 8 [SIMPLE_EDGE]
-                                                      Reduce Output Operator [RS_16]
+                                                      Reduce Output Operator [RS_20]
                                                          key expressions:_col3 (type: bigint), _col1 (type: int)
                                                          sort order:+-
                                                          Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
                                                          value expressions:_col0 (type: string), _col2 (type: bigint)
-                                                         Select Operator [SEL_15]
+                                                         Select Operator [SEL_19]
                                                             outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                             Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
-                                                            Group By Operator [GBY_14]
+                                                            Group By Operator [GBY_18]
                                                             |  aggregations:["sum(VALUE._col0)"]
                                                             |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                                             |  outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                             |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                             |<-Map 7 [SIMPLE_EDGE]
-                                                               Reduce Output Operator [RS_13]
+                                                               Reduce Output Operator [RS_17]
                                                                   key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                                   Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                                   sort order:+++
                                                                   Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                                   value expressions:_col3 (type: bigint)
-                                                                  Group By Operator [GBY_12]
+                                                                  Group By Operator [GBY_16]
                                                                      aggregations:["sum(_col1)"]
                                                                      keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                                      outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                                      Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                                                     Select Operator [SEL_10]
+                                                                     Select Operator [SEL_12]
                                                                         outputColumnNames:["_col0","_col1","_col2"]
                                                                         Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                                        Filter Operator [FIL_49]
-                                                                           predicate:(((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) and key is not null) (type: boolean)
+                                                                        Filter Operator [FIL_52]
+                                                                           predicate:((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) (type: boolean)
                                                                            Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                                           TableScan [TS_8]
+                                                                           TableScan [TS_10]
                                                                               alias:cbo_t1
                                                                               Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
 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
@@ -859,142 +856,142 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 5
-         File Output Operator [FS_35]
+         File Output Operator [FS_39]
             compressed:false
             Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
-            Group By Operator [GBY_33]
+            Group By Operator [GBY_37]
             |  aggregations:["count(VALUE._col0)"]
             |  keys:KEY._col0 (type: int), KEY._col1 (type: bigint)
             |  outputColumnNames:["_col0","_col1","_col2"]
             |  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             |<-Reducer 4 [SIMPLE_EDGE]
-               Reduce Output Operator [RS_32]
+               Reduce Output Operator [RS_36]
                   key expressions:_col0 (type: int), _col1 (type: bigint)
                   Map-reduce partition columns:_col0 (type: int), _col1 (type: bigint)
                   sort order:++
                   Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions:_col2 (type: bigint)
-                  Group By Operator [GBY_31]
+                  Group By Operator [GBY_35]
                      aggregations:["count()"]
                      keys:_col0 (type: int), _col1 (type: bigint)
                      outputColumnNames:["_col0","_col1","_col2"]
                      Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                     Select Operator [SEL_29]
+                     Select Operator [SEL_33]
                         outputColumnNames:["_col0","_col1"]
                         Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                        Filter Operator [FIL_39]
+                        Filter Operator [FIL_43]
                            predicate:(((_col1 + _col4) >= 2) and ((_col1 > 0) or (_col6 >= 0))) (type: boolean)
                            Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                           Merge Join Operator [MERGEJOIN_44]
+                           Merge Join Operator [MERGEJOIN_48]
                            |  condition map:[{"":"Right Outer Join0 to 1"}]
                            |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                            |  outputColumnNames:["_col1","_col2","_col4","_col6"]
                            |  Statistics:Num rows: 4 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
                            |<-Map 9 [SIMPLE_EDGE]
-                           |  Reduce Output Operator [RS_26]
+                           |  Reduce Output Operator [RS_30]
                            |     key expressions:_col0 (type: string)
                            |     Map-reduce partition columns:_col0 (type: string)
                            |     sort order:+
                            |     Statistics:Num rows: 20 Data size: 1602 Basic stats: COMPLETE Column stats: COMPLETE
                            |     value expressions:_col1 (type: int)
-                           |     Select Operator [SEL_24]
+                           |     Select Operator [SEL_28]
                            |        outputColumnNames:["_col0","_col1"]
                            |        Statistics:Num rows: 20 Data size: 1602 Basic stats: COMPLETE Column stats: COMPLETE
-                           |        TableScan [TS_23]
+                           |        TableScan [TS_27]
                            |           alias:cbo_t3
                            |           Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                            |<-Reducer 3 [SIMPLE_EDGE]
-                              Reduce Output Operator [RS_25]
+                              Reduce Output Operator [RS_29]
                                  key expressions:_col0 (type: string)
                                  Map-reduce partition columns:_col0 (type: string)
                                  sort order:+
                                  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                  value expressions:_col1 (type: int), _col2 (type: bigint), _col4 (type: int)
-                                 Select Operator [SEL_22]
+                                 Select Operator [SEL_26]
                                     outputColumnNames:["_col0","_col1","_col2","_col4"]
                                     Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                    Merge Join Operator [MERGEJOIN_43]
+                                    Merge Join Operator [MERGEJOIN_47]
                                     |  condition map:[{"":"Left Outer Join0 to 1"}]
                                     |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                                     |  outputColumnNames:["_col1","_col2","_col3","_col4"]
                                     |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                     |<-Reducer 2 [SIMPLE_EDGE]
-                                    |  Reduce Output Operator [RS_19]
+                                    |  Reduce Output Operator [RS_23]
                                     |     key expressions:_col0 (type: string)
                                     |     Map-reduce partition columns:_col0 (type: string)
                                     |     sort order:+
                                     |     Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
                                     |     value expressions:_col1 (type: int)
-                                    |     Select Operator [SEL_7]
+                                    |     Select Operator [SEL_9]
                                     |        outputColumnNames:["_col0","_col1"]
                                     |        Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
-                                    |        Group By Operator [GBY_6]
+                                    |        Group By Operator [GBY_8]
                                     |        |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                     |        |  outputColumnNames:["_col0","_col1","_col2"]
                                     |        |  Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                     |        |<-Map 1 [SIMPLE_EDGE]
-                                    |           Reduce Output Operator [RS_5]
+                                    |           Reduce Output Operator [RS_7]
                                     |              key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                     |              Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                     |              sort order:+++
                                     |              Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                    |              Group By Operator [GBY_4]
+                                    |              Group By Operator [GBY_6]
                                     |                 keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                     |                 outputColumnNames:["_col0","_col1","_col2"]
                                     |                 Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                     |                 Select Operator [SEL_2]
                                     |                    outputColumnNames:["_col0","_col1","_col2"]
                                     |                    Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                    |                    Filter Operator [FIL_41]
+                                    |                    Filter Operator [FIL_45]
                                     |                       predicate:((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) (type: boolean)
                                     |                       Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                     |                       TableScan [TS_0]
                                     |                          alias:cbo_t2
                                     |                          Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                                     |<-Reducer 8 [SIMPLE_EDGE]
-                                       Reduce Output Operator [RS_20]
+                                       Reduce Output Operator [RS_24]
                                           key expressions:_col0 (type: string)
                                           Map-reduce partition columns:_col0 (type: string)
                                           sort order:+
                                           Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                           value expressions:_col1 (type: int), _col2 (type: bigint)
-                                          Select Operator [SEL_17]
+                                          Select Operator [SEL_21]
                                           |  outputColumnNames:["_col0","_col1","_col2"]
                                           |  Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                           |<-Reducer 7 [SIMPLE_EDGE]
-                                             Reduce Output Operator [RS_16]
+                                             Reduce Output Operator [RS_20]
                                                 key expressions:_col3 (type: bigint), _col0 (type: string)
                                                 sort order:+-
                                                 Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
                                                 value expressions:_col1 (type: int), _col2 (type: bigint)
-                                                Select Operator [SEL_15]
+                                                Select Operator [SEL_19]
                                                    outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                    Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
-                                                   Group By Operator [GBY_14]
+                                                   Group By Operator [GBY_18]
                                                    |  aggregations:["sum(VALUE._col0)"]
                                                    |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                                    |  outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                    |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                    |<-Map 6 [SIMPLE_EDGE]
-                                                      Reduce Output Operator [RS_13]
+                                                      Reduce Output Operator [RS_17]
                                                          key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                          Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                          sort order:+++
                                                          Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                          value expressions:_col3 (type: bigint)
-                                                         Group By Operator [GBY_12]
+                                                         Group By Operator [GBY_16]
                                                             aggregations:["sum(_col1)"]
                                                             keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                             outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                             Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                                            Select Operator [SEL_10]
+                                                            Select Operator [SEL_12]
                                                                outputColumnNames:["_col0","_col1","_col2"]
                                                                Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                               Filter Operator [FIL_42]
+                                                               Filter Operator [FIL_46]
                                                                   predicate:((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) (type: boolean)
                                                                   Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                                  TableScan [TS_8]
+                                                                  TableScan [TS_10]
                                                                      alias:cbo_t1
                                                                      Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
 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
@@ -1018,155 +1015,152 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 7
-         File Output Operator [FS_41]
+         File Output Operator [FS_46]
             compressed:false
             Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
-            Select Operator [SEL_40]
+            Select Operator [SEL_45]
             |  outputColumnNames:["_col0","_col1","_col2"]
             |  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             |<-Reducer 6 [SIMPLE_EDGE]
-               Reduce Output Operator [RS_39]
+               Reduce Output Operator [RS_44]
                   key expressions:_col0 (type: int)
                   sort order:+
                   Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions:_col1 (type: bigint), _col2 (type: bigint)
-                  Group By Operator [GBY_37]
+                  Group By Operator [GBY_42]
                   |  aggregations:["count(VALUE._col0)"]
                   |  keys:KEY._col0 (type: int), KEY._col1 (type: bigint)
                   |  outputColumnNames:["_col0","_col1","_col2"]
                   |  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   |<-Reducer 5 [SIMPLE_EDGE]
-                     Reduce Output Operator [RS_36]
+                     Reduce Output Operator [RS_41]
                         key expressions:_col0 (type: int), _col1 (type: bigint)
                         Map-reduce partition columns:_col0 (type: int), _col1 (type: bigint)
                         sort order:++
                         Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions:_col2 (type: bigint)
-                        Group By Operator [GBY_35]
+                        Group By Operator [GBY_40]
                            aggregations:["count()"]
                            keys:_col0 (type: int), _col1 (type: bigint)
                            outputColumnNames:["_col0","_col1","_col2"]
                            Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                           Select Operator [SEL_33]
+                           Select Operator [SEL_36]
                               outputColumnNames:["_col0","_col1"]
                               Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                              Filter Operator [FIL_44]
-                                 predicate:(((((_col1 + _col4) >= 0) and ((_col1 > 0) or (_col6 >= 0))) and ((_col6 >= 1) or (_col2 >= 1))) and ((UDFToLong(_col6) + _col2) >= 0)) (type: boolean)
+                              Filter Operator [FIL_48]
+                                 predicate:(((((_col6 > 0) and ((_col6 >= 1) or (_col2 >= 1))) and ((UDFToLong(_col6) + _col2) >= 0)) and ((_col1 + _col4) >= 0)) and ((_col1 > 0) or (_col6 >= 0))) (type: boolean)
                                  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                                 Merge Join Operator [MERGEJOIN_50]
-                                 |  condition map:[{"":"Right Outer Join0 to 1"}]
+                                 Merge Join Operator [MERGEJOIN_52]
+                                 |  condition map:[{"":"Outer Join 0 to 1"}]
                                  |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                                  |  outputColumnNames:["_col1","_col2","_col4","_col6"]
-                                 |  Statistics:Num rows: 3 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |  Statistics:Num rows: 4 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
                                  |<-Map 11 [SIMPLE_EDGE]
-                                 |  Reduce Output Operator [RS_30]
+                                 |  Reduce Output Operator [RS_33]
                                  |     key expressions:_col0 (type: string)
                                  |     Map-reduce partition columns:_col0 (type: string)
                                  |     sort order:+
-                                 |     Statistics:Num rows: 6 Data size: 445 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |     Statistics:Num rows: 20 Data size: 1602 Basic stats: COMPLETE Column stats: COMPLETE
                                  |     value expressions:_col1 (type: int)
-                                 |     Select Operator [SEL_28]
+                                 |     Select Operator [SEL_31]
                                  |        outputColumnNames:["_col0","_col1"]
-                                 |        Statistics:Num rows: 6 Data size: 445 Basic stats: COMPLETE Column stats: COMPLETE
-                                 |        Filter Operator [FIL_48]
-                                 |           predicate:(c_int > 0) (type: boolean)
-                                 |           Statistics:Num rows: 6 Data size: 445 Basic stats: COMPLETE Column stats: COMPLETE
-                                 |           TableScan [TS_26]
-                                 |              alias:cbo_t3
-                                 |              Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |        Statistics:Num rows: 20 Data size: 1602 Basic stats: COMPLETE Column stats: COMPLETE
+                                 |        TableScan [TS_30]
+                                 |           alias:cbo_t3
+                                 |           Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                                  |<-Reducer 4 [SIMPLE_EDGE]
-                                    Reduce Output Operator [RS_29]
+                                    Reduce Output Operator [RS_32]
                                        key expressions:_col0 (type: string)
                                        Map-reduce partition columns:_col0 (type: string)
                                        sort order:+
                                        Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                        value expressions:_col1 (type: int), _col2 (type: bigint), _col4 (type: int)
-                                       Select Operator [SEL_25]
+                                       Select Operator [SEL_29]
                                           outputColumnNames:["_col0","_col1","_col2","_col4"]
                                           Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                          Merge Join Operator [MERGEJOIN_49]
+                                          Merge Join Operator [MERGEJOIN_51]
                                           |  condition map:[{"":"Outer Join 0 to 1"}]
                                           |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                                           |  outputColumnNames:["_col1","_col2","_col3","_col4"]
                                           |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                           |<-Reducer 10 [SIMPLE_EDGE]
-                                          |  Reduce Output Operator [RS_23]
+                                          |  Reduce Output Operator [RS_27]
                                           |     key expressions:_col0 (type: string)
                                           |     Map-reduce partition columns:_col0 (type: string)
                                           |     sort order:+
                                           |     Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                           |     value expressions:_col1 (type: int), _col2 (type: bigint)
-                                          |     Select Operator [SEL_20]
+                                          |     Select Operator [SEL_24]
                                           |     |  outputColumnNames:["_col0","_col1","_col2"]
                                           |     |  Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                           |     |<-Reducer 9 [SIMPLE_EDGE]
-                                          |        Reduce Output Operator [RS_19]
+                                          |        Reduce Output Operator [RS_23]
                                           |           key expressions:_col3 (type: double)
                                           |           sort order:-
                                           |           Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
                                           |           value expressions:_col0 (type: string), _col1 (type: int), _col2 (type: bigint)
-                                          |           Select Operator [SEL_18]
+                                          |           Select Operator [SEL_22]
                                           |              outputColumnNames:["_col0","_col1","_col2","_col3"]
                                           |              Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
-                                          |              Group By Operator [GBY_17]
+                                          |              Group By Operator [GBY_21]
                                           |              |  aggregations:["sum(VALUE._col0)"]
                                           |              |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                           |              |  outputColumnNames:["_col0","_col1","_col2","_col3"]
                                           |              |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                           |              |<-Map 8 [SIMPLE_EDGE]
-                                          |                 Reduce Output Operator [RS_16]
+                                          |                 Reduce Output Operator [RS_20]
                                           |                    key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                           |                    Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                           |                    sort order:+++
                                           |                    Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                           |                    value expressions:_col3 (type: bigint)
-                                          |                    Group By Operator [GBY_15]
+                                          |                    Group By Operator [GBY_19]
                                           |                       aggregations:["sum(_col1)"]
                                           |                       keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                           |                       outputColumnNames:["_col0","_col1","_col2","_col3"]
                                           |                       Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                          |                       Select Operator [SEL_13]
+                                          |                       Select Operator [SEL_15]
                                           |                          outputColumnNames:["_col0","_col1","_col2"]
                                           |                          Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                          |                          Filter Operator [FIL_47]
+                                          |                          Filter Operator [FIL_50]
                                           |                             predicate:((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) (type: boolean)
                                           |                             Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                          |                             TableScan [TS_11]
+                                          |                             TableScan [TS_13]
                                           |                                alias:cbo_t1
                                           |                                Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                                           |<-Reducer 3 [SIMPLE_EDGE]
-                                             Reduce Output Operator [RS_22]
+                                             Reduce Output Operator [RS_26]
                                                 key expressions:_col0 (type: string)
                                                 Map-reduce partition columns:_col0 (type: string)
                                                 sort order:+
                                                 Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
                                                 value expressions:_col1 (type: int)
-                                                Select Operator [SEL_9]
+                                                Select Operator [SEL_11]
                                                 |  outputColumnNames:["_col0","_col1"]
                                                 |  Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
                                                 |<-Reducer 2 [SIMPLE_EDGE]
-                                                   Reduce Output Operator [RS_8]
+                                                   Reduce Output Operator [RS_10]
                                                       key expressions:_col3 (type: double), _col2 (type: bigint)
                                                       sort order:-+
                                                       Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
                                                       value expressions:_col0 (type: string), _col1 (type: int)
-                                                      Select Operator [SEL_7]
+                                                      Select Operator [SEL_9]
                                                          outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                          Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
-                                                         Group By Operator [GBY_6]
+                                                         Group By Operator [GBY_8]
                                                          |  aggregations:["sum(VALUE._col0)"]
                                                          |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                                          |  outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                          |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                          |<-Map 1 [SIMPLE_EDGE]
-                                                            Reduce Output Operator [RS_5]
+                                                            Reduce Output Operator [RS_7]
                                                                key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                                Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                                sort order:+++
                                                                Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                                value expressions:_col3 (type: bigint)
-                                                               Group By Operator [GBY_4]
+                                                               Group By Operator [GBY_6]
                                                                   aggregations:["sum(_col1)"]
                                                                   keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                                   outputColumnNames:["_col0","_col1","_col2","_col3"]
@@ -1174,7 +1168,7 @@ Stage-0
                                                                   Select Operator [SEL_2]
                                                                      outputColumnNames:["_col0","_col1","_col2"]
                                                                      Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                                     Filter Operator [FIL_46]
+                                                                     Filter Operator [FIL_49]
                                                                         predicate:((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) (type: boolean)
                                                                         Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                                                         TableScan [TS_0]
@@ -1198,40 +1192,40 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 3
-         File Output Operator [FS_39]
+         File Output Operator [FS_43]
             compressed:false
             Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
-            Group By Operator [GBY_37]
+            Group By Operator [GBY_41]
             |  aggregations:["count(VALUE._col0)"]
             |  keys:KEY._col0 (type: int), KEY._col1 (type: bigint)
             |  outputColumnNames:["_col0","_col1","_col2"]
             |  Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
             |<-Reducer 2 [SIMPLE_EDGE]
-               Reduce Output Operator [RS_36]
+               Reduce Output Operator [RS_40]
                   key expressions:_col0 (type: int), _col1 (type: bigint)
                   Map-reduce partition columns:_col0 (type: int), _col1 (type: bigint)
                   sort order:++
                   Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions:_col2 (type: bigint)
-                  Group By Operator [GBY_35]
+                  Group By Operator [GBY_39]
                      aggregations:["count()"]
                      keys:_col0 (type: int), _col1 (type: bigint)
                      outputColumnNames:["_col0","_col1","_col2"]
                      Statistics:Num rows: 1 Data size: 20 Basic stats: COMPLETE Column stats: COMPLETE
-                     Select Operator [SEL_31]
+                     Select Operator [SEL_35]
                         outputColumnNames:["_col0","_col1"]
                         Statistics:Num rows: 2 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
-                        Filter Operator [FIL_45]
+                        Filter Operator [FIL_49]
                            predicate:((_col3 > 0) or (_col1 >= 0)) (type: boolean)
                            Statistics:Num rows: 2 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
-                           Merge Join Operator [MERGEJOIN_51]
+                           Merge Join Operator [MERGEJOIN_55]
                            |  condition map:[{"":"Inner Join 0 to 1"}]
                            |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                            |  outputColumnNames:["_col1","_col3","_col4"]
                            |  Statistics:Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                            |<-Map 1 [SIMPLE_EDGE]
-                           |  Reduce Output Operator [RS_27]
+                           |  Reduce Output Operator [RS_31]
                            |     key expressions:_col0 (type: string)
                            |     Map-reduce partition columns:_col0 (type: string)
                            |     sort order:+
@@ -1240,97 +1234,97 @@ Stage-0
                            |     Select Operator [SEL_1]
                            |        outputColumnNames:["_col0","_col1"]
                            |        Statistics:Num rows: 18 Data size: 1424 Basic stats: COMPLETE Column stats: COMPLETE
-                           |        Filter Operator [FIL_46]
+                           |        Filter Operator [FIL_50]
                            |           predicate:key is not null (type: boolean)
                            |           Statistics:Num rows: 18 Data size: 1424 Basic stats: COMPLETE Column stats: COMPLETE
                            |           TableScan [TS_0]
                            |              alias:cbo_t3
                            |              Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                            |<-Reducer 6 [SIMPLE_EDGE]
-                              Reduce Output Operator [RS_29]
+                              Reduce Output Operator [RS_33]
                                  key expressions:_col0 (type: string)
                                  Map-reduce partition columns:_col0 (type: string)
                                  sort order:+
                                  Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                  value expressions:_col1 (type: int), _col2 (type: bigint)
-                                 Select Operator [SEL_23]
+                                 Select Operator [SEL_27]
                                     outputColumnNames:["_col0","_col1","_col2"]
                                     Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
-                                    Filter Operator [FIL_47]
+                                    Filter Operator [FIL_51]
                                        predicate:((_col3 + _col1) >= 0) (type: boolean)
                                        Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                       Merge Join Operator [MERGEJOIN_50]
+                                       Merge Join Operator [MERGEJOIN_54]
                                        |  condition map:[{"":"Inner Join 0 to 1"}]
                                        |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                                        |  outputColumnNames:["_col1","_col2","_col3","_col4"]
                                        |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                        |<-Reducer 5 [SIMPLE_EDGE]
-                                       |  Reduce Output Operator [RS_19]
+                                       |  Reduce Output Operator [RS_23]
                                        |     key expressions:_col0 (type: string)
                                        |     Map-reduce partition columns:_col0 (type: string)
                                        |     sort order:+
                                        |     Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
                                        |     value expressions:_col1 (type: int)
-                                       |     Select Operator [SEL_9]
+                                       |     Select Operator [SEL_11]
                                        |        outputColumnNames:["_col0","_col1"]
                                        |        Statistics:Num rows: 1 Data size: 89 Basic stats: COMPLETE Column stats: COMPLETE
-                                       |        Group By Operator [GBY_8]
+                                       |        Group By Operator [GBY_10]
                                        |        |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                        |        |  outputColumnNames:["_col0","_col1","_col2"]
                                        |        |  Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                        |        |<-Map 4 [SIMPLE_EDGE]
-                                       |           Reduce Output Operator [RS_7]
+                                       |           Reduce Output Operator [RS_9]
                                        |              key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                        |              Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                        |              sort order:+++
                                        |              Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                       |              Group By Operator [GBY_6]
+                                       |              Group By Operator [GBY_8]
                                        |                 keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                        |                 outputColumnNames:["_col0","_col1","_col2"]
                                        |                 Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                        |                 Select Operator [SEL_4]
                                        |                    outputColumnNames:["_col0","_col1","_col2"]
                                        |                    Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                       |                    Filter Operator [FIL_48]
+                                       |                    Filter Operator [FIL_52]
                                        |                       predicate:(((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) and key is not null) (type: boolean)
                                        |                       Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                                        |                       TableScan [TS_2]
                                        |                          alias:cbo_t2
                                        |                          Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                                        |<-Reducer 8 [SIMPLE_EDGE]
-                                          Reduce Output Operator [RS_21]
+                                          Reduce Output Operator [RS_25]
                                              key expressions:_col0 (type: string)
                                              Map-reduce partition columns:_col0 (type: string)
                                              sort order:+
                                              Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
                                              value expressions:_col1 (type: int), _col2 (type: bigint)
-                                             Select Operator [SEL_17]
+                                             Select Operator [SEL_21]
                                                 outputColumnNames:["_col0","_col1","_col2"]
                                                 Statistics:Num rows: 1 Data size: 97 Basic stats: COMPLETE Column stats: COMPLETE
-                                                Group By Operator [GBY_16]
+                                                Group By Operator [GBY_20]
                                                 |  aggregations:["sum(VALUE._col0)"]
                                                 |  keys:KEY._col0 (type: float), KEY._col1 (type: int), KEY._col2 (type: string)
                                                 |  outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                 |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                 |<-Map 7 [SIMPLE_EDGE]
-                                                   Reduce Output Operator [RS_15]
+                                                   Reduce Output Operator [RS_19]
                                                       key expressions:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                       Map-reduce partition columns:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                       sort order:+++
                                                       Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                                                       value expressions:_col3 (type: bigint)
-                                                      Group By Operator [GBY_14]
+                                                      Group By Operator [GBY_18]
                                                          aggregations:["sum(_col1)"]
                                                          keys:_col0 (type: float), _col1 (type: int), _col2 (type: string)
                                                          outputColumnNames:["_col0","_col1","_col2","_col3"]
                                                          Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                                                         Select Operator [SEL_12]
+                                                         Select Operator [SEL_14]
                                                             outputColumnNames:["_col0","_col1","_col2"]
                                                             Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                            Filter Operator [FIL_49]
+                                                            Filter Operator [FIL_53]
                                                                predicate:(((((((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0))) and (c_float > 0.0)) and ((c_int >= 1) or (c_float >= 1.0))) and ((UDFToFloat(c_int) + c_float) >= 0.0)) and key is not null) (type: boolean)
                                                                Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
-                                                               TableScan [TS_10]
+                                                               TableScan [TS_12]
                                                                   alias:cbo_t1
                                                                   Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
 PREHOOK: query: explain select unionsrc.key FROM (select 'tst1' as key, count(1) as value from src) unionsrc
@@ -1952,17 +1946,17 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 3
-         File Output Operator [FS_20]
+         File Output Operator [FS_22]
             compressed:false
-            Statistics:Num rows: 8 Data size: 808 Basic stats: COMPLETE Column stats: COMPLETE
+            Statistics:Num rows: 4 Data size: 404 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
             Select Operator [SEL_19]
                outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
-               Statistics:Num rows: 8 Data size: 808 Basic stats: COMPLETE Column stats: COMPLETE
+               Statistics:Num rows: 4 Data size: 404 Basic stats: COMPLETE Column stats: COMPLETE
                Filter Operator [FIL_18]
-                  predicate:((_col1 > 0) or (_col6 >= 0)) (type: boolean)
-                  Statistics:Num rows: 8 Data size: 808 Basic stats: COMPLETE Column stats: COMPLETE
-                  Merge Join Operator [MERGEJOIN_29]
+                  predicate:(((_col4 + 1) = 2) and ((_col1 > 0) or (_col6 >= 0))) (type: boolean)
+                  Statistics:Num rows: 4 Data size: 404 Basic stats: COMPLETE Column stats: COMPLETE
+                  Merge Join Operator [MERGEJOIN_32]
                   |  condition map:[{"":"Inner Join 0 to 1"}]
                   |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                   |  outputColumnNames:["_col1","_col2","_col3","_col4","_col6"]
@@ -1977,7 +1971,7 @@ Stage-0
                   |     Select Operator [SEL_12]
                   |        outputColumnNames:["_col0","_col1"]
                   |        Statistics:Num rows: 18 Data size: 1424 Basic stats: COMPLETE Column stats: COMPLETE
-                  |        Filter Operator [FIL_27]
+                  |        Filter Operator [FIL_30]
                   |           predicate:key is not null (type: boolean)
                   |           Statistics:Num rows: 18 Data size: 1424 Basic stats: COMPLETE Column stats: COMPLETE
                   |           TableScan [TS_11]
@@ -1990,10 +1984,10 @@ Stage-0
                         sort order:+
                         Statistics:Num rows: 4 Data size: 728 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions:_col1 (type: int), _col2 (type: float), _col3 (type: string), _col4 (type: int)
-                        Filter Operator [FIL_24]
-                           predicate:((((_col1 + _col4) = 2) and ((_col4 + 1) = 2)) and _col0 is not null) (type: boolean)
+                        Filter Operator [FIL_27]
+                           predicate:((((_col1 + _col4) = 2) and _col0 is not null) and ((_col4 + 1) = 2)) (type: boolean)
                            Statistics:Num rows: 4 Data size: 728 Basic stats: COMPLETE Column stats: COMPLETE
-                           Merge Join Operator [MERGEJOIN_28]
+                           Merge Join Operator [MERGEJOIN_31]
                            |  condition map:[{"":"Outer Join 0 to 1"}]
                            |  keys:{"1":"_col0 (type: string)","0":"_col0 (type: string)"}
                            |  outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
@@ -2008,7 +2002,7 @@ Stage-0
                            |     Select Operator [SEL_2]
                            |        outputColumnNames:["_col0","_col1","_col2"]
                            |        Statistics:Num rows: 6 Data size: 465 Basic stats: COMPLETE Column stats: COMPLETE
-                           |        Filter Operator [FIL_25]
+                           |        Filter Operator [FIL_28]
                            |           predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0.0))) (type: boolean)
                            |           Statistics:Num rows: 6 Data size: 465 Basic stats: COMPLETE Column stats: COMPLETE
                            |           TableScan [TS_0]
@@ -2024,7 +2018,7 @@ Stage-0
                                  Select Operator [SEL_5]
                                     outputColumnNames:["_col0","_col1"]
                                     Statistics:Num rows: 6 Data size: 445 Basic stats: COMPLETE Column stats: COMPLETE
-                                    Filter Operator [FIL_26]
+                                    Filter Operator [FIL_29]
                                        predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0.0))) (type: boolean)
                                        Statistics:Num rows: 6 Data size: 465 Basic stats: COMPLETE Column stats: COMPLETE
                                        TableScan [TS_3]
@@ -2044,17 +2038,17 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 2
-         File Output Operator [FS_14]
+         File Output Operator [FS_16]
             compressed:false
             Statistics:Num rows: 12 Data size: 1212 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
             Select Operator [SEL_13]
                outputColumnNames:["_col0","_col1","_col2","_col3","_col4"]
                Statistics:Num rows: 12 Data size: 1212 Basic stats: COMPLETE Column stats: COMPLETE
-               Filter Operator [FIL_17]
-                  predicate:((((_col1 + _col4) = 2) and ((_col1 > 0) or (_col6 >= 0))) and ((_col4 + 1) = 2)) (type: boolean)
+               Filter Operator [FIL_20]
+                  predicate:((((_col4 + 1) = 2) and ((_col1 > 0) or (_col6 >= 0))) and ((_col1 + _col4) = 2)) (type: boolean)
                   Statistics:Num rows: 12 Data size: 1212 Basic stats: COMPLETE Column stats: COMPLETE
-                  Merge Join Operator [MERGEJOIN_20]
+                  Merge Join Operator [MERGEJOIN_23]
                   |  condition map:[{"":"Right Outer Join0 to 1"},{"":"Right Outer Join0 to 2"}]
                   |  keys:{"2":"_col0 (type: string)","1":"_col0 (type: string)","0":"_col0 (type: string)"}
                   |  outputColumnNames:["_col1","_col2","_col3","_col4","_col6"]
@@ -2069,7 +2063,7 @@ Stage-0
                   |     Select Operator [SEL_2]
                   |        outputColumnNames:["_col0","_col1","_col2"]
                   |        Statistics:Num rows: 6 Data size: 465 Basic stats: COMPLETE Column stats: COMPLETE
-                  |        Filter Operator [FIL_18]
+                  |        Filter Operator [FIL_21]
                   |           predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0.0))) (type: boolean)
                   |           Statistics:Num rows: 6 Data size: 465 Basic stats: COMPLETE Column stats: COMPLETE
                   |           TableScan [TS_0]
@@ -2085,7 +2079,7 @@ Stage-0
                   |     Select Operator [SEL_5]
                   |        outputColumnNames:["_col0","_col1"]
                   |        Statistics:Num rows: 6 Data size: 445 Basic stats: COMPLETE Column stats: COMPLETE
-                  |        Filter Operator [FIL_19]
+                  |        Filter Operator [FIL_22]
                   |           predicate:(((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0.0))) (type: boolean)
                   |           Statistics:Num rows: 6 Data size: 465 Basic stats: COMPLETE Column stats: COMPLETE
                   |           TableScan [TS_3]
@@ -2633,20 +2627,20 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 2
-         File Output Operator [FS_20]
+         File Output Operator [FS_24]
             compressed:false
             Statistics:Num rows: 12 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
-            Select Operator [SEL_19]
+            Select Operator [SEL_23]
                outputColumnNames:["_col0","_col1","_col2"]
                Statistics:Num rows: 12 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
-               Merge Join Operator [MERGEJOIN_30]
+               Merge Join Operator [MERGEJOIN_34]
                |  condition map:[{"":"Left Semi Join 0 to 1"},{"":"Left Semi Join 0 to 2"}]
                |  keys:{"2":"_col0 (type: string)","1":"_col0 (type: string)","0":"_col0 (type: string)"}
                |  outputColumnNames:["_col0","_col1","_col2"]
                |  Statistics:Num rows: 12 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
                |<-Map 1 [SIMPLE_EDGE]
-               |  Reduce Output Operator [RS_13]
+               |  Reduce Output Operator [RS_17]
                |     key expressions:_col0 (type: string)
                |     Map-reduce partition columns:_col0 (type: string)
                |     sort order:+
@@ -2655,48 +2649,48 @@ Stage-0
                |     Select Operator [SEL_2]
                |        outputColumnNames:["_col0","_col1","_col2"]
                |        Statistics:Num rows: 5 Data size: 372 Basic stats: COMPLETE Column stats: COMPLETE
-               |        Filter Operator [FIL_27]
+               |        Filter Operator [FIL_31]
                |           predicate:((((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0.0))) and key is not null) (type: boolean)
                |           Statistics:Num rows: 5 Data size: 372 Basic stats: COMPLETE Column stats: COMPLETE
                |           TableScan [TS_0]
                |              alias:cbo_t1
                |              Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                |<-Map 3 [SIMPLE_EDGE]
-               |  Reduce Output Operator [RS_15]
+               |  Reduce Output Operator [RS_19]
                |     key expressions:_col0 (type: string)
                |     Map-reduce partition columns:_col0 (type: string)
                |     sort order:+
                |     Statistics:Num rows: 2 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
-               |     Group By Operator [GBY_9]
+               |     Group By Operator [GBY_13]
                |        keys:_col0 (type: string)
                |        outputColumnNames:["_col0"]
                |        Statistics:Num rows: 2 Data size: 170 Basic stats: COMPLETE Column stats: COMPLETE
-               |        Select Operator [SEL_5]
+               |        Select Operator [SEL_9]
                |           outputColumnNames:["_col0"]
                |           Statistics:Num rows: 5 Data size: 340 Basic stats: COMPLETE Column stats: COMPLETE
-               |           Filter Operator [FIL_28]
+               |           Filter Operator [FIL_32]
                |              predicate:((((c_int + 1) = 2) and ((c_int > 0) or (c_float >= 0.0))) and key is not null) (type: boolean)
                |              Statistics:Num rows: 5 Data size: 372 Basic stats: COMPLETE Column stats: COMPLETE
-               |              TableScan [TS_3]
+               |              TableScan [TS_7]
                |                 alias:cbo_t2
                |                 Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                |<-Map 4 [SIMPLE_EDGE]
-                  Reduce Output Operator [RS_17]
+                  Reduce Output Operator [RS_21]
                      key expressions:_col0 (type: string)
                      Map-reduce partition columns:_col0 (type: string)
                      sort order:+
                      Statistics:Num rows: 6 Data size: 425 Basic stats: COMPLETE Column stats: COMPLETE
-                     Group By Operator [GBY_11]
+                     Group By Operator [GBY_15]
                         keys:_col0 (type: string)
                         outputColumnNames:["_col0"]
                         Statistics:Num rows: 6 Data size: 425 Basic stats: COMPLETE Column stats: COMPLETE
-                        Select Operator [SEL_7]
+                        Select Operator [SEL_11]
                            outputColumnNames:["_col0"]
                            Statistics:Num rows: 18 Data size: 1360 Basic stats: COMPLETE Column stats: COMPLETE
-                           Filter Operator [FIL_29]
+                           Filter Operator [FIL_33]
                               predicate:key is not null (type: boolean)
                               Statistics:Num rows: 18 Data size: 1360 Basic stats: COMPLETE Column stats: COMPLETE
-                              TableScan [TS_6]
+                              TableScan [TS_10]
                                  alias:cbo_t3
                                  Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
 PREHOOK: query: explain select a, 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 a+b desc, c asc) cbo_t1 left semi 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 q+r/10 desc, p) cbo_t2 on cbo_t1.a=p left semi join cbo_t3 on cbo_t1.a=key where (b + 1  >= 0) and (b > 0 or a >= 0) group by a, c  having a > 0 and (a >=1 or c >= 1) and (a + c) >= 0 order by c, a
@@ -2719,98 +2713,98 @@ Stage-0
       limit:-1
       Stage-1
          Reducer 6
-         File Output Operator [FS_44]
+         File Output Operator [FS_50]
             compressed:false
             Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
             table:{"serde:":"org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe","input format:":"org.apache.hadoop.mapred.TextInputFormat","output format:":"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"}
-            Select Operator [SEL_43]
+            Select Operator [SEL_49]
             |  outputColumnNames:["_col0","_col1","_col2"]
             |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
             |<-Reducer 5 [SIMPLE_EDGE]
-               Reduce Output Operator [RS_42]
+               Reduce Output Operator [RS_48]
                   key expressions:_col1 (type: bigint), _col0 (type: string)
                   sort order:++
                   Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions:_col2 (type: bigint)
-                  Group By Operator [GBY_40]
+                  Group By Operator [GBY_46]
                   |  aggregations:["count(VALUE._col0)"]
                   |  keys:KEY._col0 (type: string), KEY._col1 (type: bigint)
                   |  outputColumnNames:["_col0","_col1","_col2"]
                   |  Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                   |<-Reducer 4 [SIMPLE_EDGE]
-                     Reduce Output Operator [RS_39]
+                     Reduce Output Operator [RS_45]
                         key expressions:_col0 (type: string), _col1 (type: bigint)
                         Map-reduce partition columns:_col0 (type: string), _col1 (type: bigint)
                         sort order:++
                         Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions:_col2 (type: bigint)
-                        Group By Operator [GBY_38]
+                        Group By Operator [GBY_44]
                            aggregations:["count()"]
                            keys:_col0 (type: string), _col1 (type: bigint)
                            outputColumnNames:["_col0","_col1","_col2"]
                            Statistics:Num rows: 1 Data size: 101 Basic stats: COMPLETE Column stats: COMPLETE
-                           Merge Join Operator [MERGEJOIN_56]
+                           Merge Join Operator [MERGEJOIN_62]
                            |  condition map:[{"":"Left Semi Join 0 to 1"},{"":"Left Semi Join 0 to 2"}]
                            |  keys:{"2":"_col0 (type: string)","1":"_col0 (type: string)","0":"_col0 (type: string)"}
                            |  outputColumnNames:["_col0","_col1"]
                            |  Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                            |<-Map 10 [SIMPLE_EDGE]
-                           |  Reduce Output Operator [RS_35]
+                           |  Reduce Output Operator [RS_41]
                            |     key expressions:_col0 (type: string)
                            |     Map-reduce partition columns:_col0 (type: string)
                            |     sort order:+
                            |     Statistics:Num rows: 6 Data size: 425 Basic stats: COMPLETE Column stats: COMPLETE
-                           |     Group By Operator [GBY_29]
+                           |     Group By Operator [GBY_35]
                            |        keys:_col0 (type: string)
                            |        outputColumnNames:["_col0"]
                            |        Statistics:Num rows: 6 Data size: 425 Basic stats: COMPLETE Column stats: COMPLETE
-                           |        Select Operator [SEL_25]
+                           |        Select Operator [SEL_31]
                            |           outputColumnNames:["_col0"]
                            |           Statistics:Num rows: 18 Data size: 1360 Basic stats: COMPLETE Column stats: COMPLETE
-                           |           Filter Operator [FIL_55]
+                           |           Filter Operator [FIL_61]
                            |              predicate:key is not null (type: boolean)
                            |              Statistics:Num rows: 18 Data size: 1360 Basic stats: COMPLETE Column stats: COMPLETE
-                           |              TableScan [TS_24]
+                           |              TableScan [TS_30]
                            |                 alias:cbo_t3
                            |                 Statistics:Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: COMPLETE
                            |<-Reducer 3 [SIMPLE_EDGE]
-                           |  Reduce Output Operator [RS_31]
+                           |  Reduce Output Operator [RS_37]
                            |     key expressions:_col0 (type: string)
                            |     Map-reduce partition columns:_col0 (type: string)
                            |     sort order:+
                            |     Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                            |     value expressions:_col1 (type: bigint)
-                           |     Select Operator [SEL_9]
+                           |     Select Operator [SEL_11]
                            |     |  outputColumnNames:["_col0","_col1"]
                            |     |  Statistics:Num rows: 1 Data size: 93 Basic stats: COMPLETE Column stats: COMPLETE
                            |     |<-Reducer 2 [SIMPLE_EDGE]
-                           |        Reduce Output Operator [RS_8]
+                           |        Reduce Output Operator [RS_10]
                            |           key expressions:_col3 (type: double), _col2 (type: bigint)
                            |           sort order:-+
                            |           Statistics:Num rows: 1 Data size: 105 Basic stats: COMPLETE Column stats: COMPLETE
          

<TRUNCATED>

[2/3] hive git commit: HIVE-9069: Simplify filter predicates for CBO (Jesus Camacho Rodriguez, reviewed by Laljo John Pullokkaran)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_udf_col.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_udf_col.q.out b/ql/src/test/results/clientpositive/ppd_udf_col.q.out
index 8f064c0..7c963fb 100644
--- a/ql/src/test/results/clientpositive/ppd_udf_col.q.out
+++ b/ql/src/test/results/clientpositive/ppd_udf_col.q.out
@@ -20,19 +20,24 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) = 100.0) and (rand() <= 0.1)) (type: boolean)
-              Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+              predicate: (UDFToDouble(key) = 100.0) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: '100' (type: string), rand() (type: double)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (rand() <= 0.1) (type: boolean)
                   Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.TextInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  Select Operator
+                    expressions: '100' (type: string), rand() (type: double)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -66,22 +71,30 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) = 100.0) and ((rand() <= 0.1) and (rand() > 0.1))) (type: boolean)
-              Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+              predicate: (UDFToDouble(key) = 100.0) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: '100' (type: string), rand() (type: double)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 20
-                  Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (rand() <= 0.1) (type: boolean)
+                  Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (rand() > 0.1) (type: boolean)
+                    Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: '100' (type: string), rand() (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                      Limit
+                        Number of rows: 20
+                        Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
+                          table:
+                              input format: org.apache.hadoop.mapred.TextInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -113,17 +126,20 @@ STAGE PLANS:
             Filter Operator
               predicate: false (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-              Select Operator
-                expressions: '100' (type: string), rand() (type: double), '4' (type: string)
-                outputColumnNames: _col0, _col1, _col2
+              Filter Operator
+                predicate: false (type: boolean)
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: '100' (type: string), rand() (type: double), '4' (type: string)
+                  outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.TextInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.TextInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -153,19 +169,26 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: (((UDFToDouble(value) * 10.0) <= 200.0) and (UDFToDouble(key) = 100.0)) (type: boolean)
+              predicate: ((UDFToDouble(key) = 100.0) and ((UDFToDouble(value) * 10.0) <= 200.0)) (type: boolean)
               Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: '100' (type: string), rand() (type: double), (UDFToDouble(value) * 10.0) (type: double)
-                outputColumnNames: _col0, _col1, _col2
+                expressions: value (type: string)
+                outputColumnNames: _col1
                 Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
-                  Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.TextInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                Filter Operator
+                  predicate: ((UDFToDouble(_col1) * 10.0) <= 200.0) (type: boolean)
+                  Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: '100' (type: string), rand() (type: double), (UDFToDouble(_col1) * 10.0) (type: double)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -195,19 +218,24 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) = 100.0) and (rand() <= 0.1)) (type: boolean)
-              Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+              predicate: (UDFToDouble(key) = 100.0) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: '100' (type: string), rand() (type: double)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (rand() <= 0.1) (type: boolean)
                   Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.TextInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  Select Operator
+                    expressions: '100' (type: string), rand() (type: double)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -241,22 +269,30 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) = 100.0) and ((rand() <= 0.1) and (rand() > 0.1))) (type: boolean)
-              Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+              predicate: (UDFToDouble(key) = 100.0) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: '100' (type: string), rand() (type: double)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 20
-                  Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: (rand() <= 0.1) (type: boolean)
+                  Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (rand() > 0.1) (type: boolean)
+                    Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: '100' (type: string), rand() (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                      Limit
+                        Number of rows: 20
+                        Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 20 Data size: 200 Basic stats: COMPLETE Column stats: NONE
+                          table:
+                              input format: org.apache.hadoop.mapred.TextInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_union.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_union.q.out b/ql/src/test/results/clientpositive/ppd_union.q.out
index 4b0c6a4..166eff1 100644
--- a/ql/src/test/results/clientpositive/ppd_union.q.out
+++ b/ql/src/test/results/clientpositive/ppd_union.q.out
@@ -34,15 +34,18 @@ STAGE PLANS:
                 expressions: key (type: string), value (type: string)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                Union
-                  Statistics: Num rows: 36 Data size: 382 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 36 Data size: 382 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                Filter Operator
+                  predicate: ((_col0 > '4') and (_col1 > 'val_4')) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 21 Basic stats: COMPLETE Column stats: NONE
+                  Union
+                    Statistics: Num rows: 4 Data size: 42 Basic stats: COMPLETE Column stats: NONE
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 4 Data size: 42 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
@@ -53,15 +56,18 @@ STAGE PLANS:
                 expressions: key (type: string), value (type: string)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                Union
-                  Statistics: Num rows: 36 Data size: 382 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 36 Data size: 382 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.TextInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                Filter Operator
+                  predicate: ((_col0 > '4') and (_col1 > 'val_4')) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 21 Basic stats: COMPLETE Column stats: NONE
+                  Union
+                    Statistics: Num rows: 4 Data size: 42 Basic stats: COMPLETE Column stats: NONE
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 4 Data size: 42 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.TextInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_vc.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_vc.q.out b/ql/src/test/results/clientpositive/ppd_vc.q.out
index f058526..a16058c 100644
--- a/ql/src/test/results/clientpositive/ppd_vc.q.out
+++ b/ql/src/test/results/clientpositive/ppd_vc.q.out
@@ -680,10 +680,10 @@ STAGE PLANS:
             name: default.srcpart
       Truncated Path -> Alias:
         /src [$hdt$_0:a]
-        /srcpart/ds=2008-04-08/hr=11 [$hdt$_1:srcpart]
-        /srcpart/ds=2008-04-08/hr=12 [$hdt$_1:srcpart]
-        /srcpart/ds=2008-04-09/hr=11 [$hdt$_1:srcpart]
-        /srcpart/ds=2008-04-09/hr=12 [$hdt$_1:srcpart]
+        /srcpart/ds=2008-04-08/hr=11 [$hdt$_1:$hdt$_1:srcpart]
+        /srcpart/ds=2008-04-08/hr=12 [$hdt$_1:$hdt$_1:srcpart]
+        /srcpart/ds=2008-04-09/hr=11 [$hdt$_1:$hdt$_1:srcpart]
+        /srcpart/ds=2008-04-09/hr=12 [$hdt$_1:$hdt$_1:srcpart]
       Needs Tagging: true
       Reduce Operator Tree:
         Join Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/spark/ppd_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/ppd_join2.q.out b/ql/src/test/results/clientpositive/spark/ppd_join2.q.out
index dd4d129..cf81423 100644
--- a/ql/src/test/results/clientpositive/spark/ppd_join2.q.out
+++ b/ql/src/test/results/clientpositive/spark/ppd_join2.q.out
@@ -47,17 +47,24 @@ STAGE PLANS:
                     predicate: (((key <> '306') and (sqrt(key) <> 13.0)) and value is not null) (type: boolean)
                     Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: value (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), value (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: _col0 is not null (type: boolean)
-                        Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string)
-                          sort order: +
-                          Map-reduce partition columns: _col0 (type: string)
-                          Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                        predicate: (sqrt(_col0) <> 13.0) (type: boolean)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                        Select Operator
+                          expressions: _col1 (type: string)
+                          outputColumnNames: _col0
+                          Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                          Filter Operator
+                            predicate: _col0 is not null (type: boolean)
+                            Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                            Reduce Output Operator
+                              key expressions: _col0 (type: string)
+                              sort order: +
+                              Map-reduce partition columns: _col0 (type: string)
+                              Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
         Map 3 
             Map Operator Tree:
                 TableScan
@@ -71,17 +78,20 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: ((_col0 <> '302') and ((_col0 <> '311') and (_col0 < '400'))) (type: boolean)
-                        Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                        predicate: (_col0 <> '14') (type: boolean)
+                        Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
                         Filter Operator
-                          predicate: _col0 is not null (type: boolean)
-                          Statistics: Num rows: 14 Data size: 148 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col0 (type: string)
-                            sort order: +
-                            Map-reduce partition columns: _col0 (type: string)
+                          predicate: ((_col0 <> '302') and ((_col0 <> '311') and (_col0 < '400'))) (type: boolean)
+                          Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                          Filter Operator
+                            predicate: _col0 is not null (type: boolean)
                             Statistics: Num rows: 14 Data size: 148 Basic stats: COMPLETE Column stats: NONE
-                            value expressions: _col1 (type: string)
+                            Reduce Output Operator
+                              key expressions: _col0 (type: string)
+                              sort order: +
+                              Map-reduce partition columns: _col0 (type: string)
+                              Statistics: Num rows: 14 Data size: 148 Basic stats: COMPLETE Column stats: NONE
+                              value expressions: _col1 (type: string)
         Map 5 
             Map Operator Tree:
                 TableScan
@@ -95,17 +105,20 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 56 Data size: 594 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: ((_col0 <> '305') and (_col0 <> '14')) (type: boolean)
-                        Statistics: Num rows: 56 Data size: 594 Basic stats: COMPLETE Column stats: NONE
+                        predicate: ((_col0 <> '311') and (((_col1 <> 'val_50') or (_col0 > '1')) and (_col0 < '400'))) (type: boolean)
+                        Statistics: Num rows: 24 Data size: 254 Basic stats: COMPLETE Column stats: NONE
                         Filter Operator
-                          predicate: _col0 is not null (type: boolean)
-                          Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col0 (type: string)
-                            sort order: +
-                            Map-reduce partition columns: _col0 (type: string)
-                            Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
-                            value expressions: _col1 (type: string)
+                          predicate: ((_col0 <> '305') and (_col0 <> '14')) (type: boolean)
+                          Statistics: Num rows: 24 Data size: 254 Basic stats: COMPLETE Column stats: NONE
+                          Filter Operator
+                            predicate: _col0 is not null (type: boolean)
+                            Statistics: Num rows: 12 Data size: 127 Basic stats: COMPLETE Column stats: NONE
+                            Reduce Output Operator
+                              key expressions: _col0 (type: string)
+                              sort order: +
+                              Map-reduce partition columns: _col0 (type: string)
+                              Statistics: Num rows: 12 Data size: 127 Basic stats: COMPLETE Column stats: NONE
+                              value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -136,26 +149,26 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
                 outputColumnNames: _col0, _col1, _col2, _col3
-                Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col2 (type: string), _col3 (type: string), _col0 (type: string), _col1 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3
-                  Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: ((_col2 <> '10') or (_col0 <> '10')) (type: boolean)
-                    Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
                       outputColumnNames: _col0, _col1, _col3
-                      Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
                         predicate: _col1 is not null (type: boolean)
-                        Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 8 Data size: 86 Basic stats: COMPLETE Column stats: NONE
                         Reduce Output Operator
                           key expressions: _col1 (type: string)
                           sort order: +
                           Map-reduce partition columns: _col1 (type: string)
-                          Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
+                          Statistics: Num rows: 8 Data size: 86 Basic stats: COMPLETE Column stats: NONE
                           value expressions: _col0 (type: string), _col3 (type: string)
 
   Stage: Stage-0

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/spark/ppd_join3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/ppd_join3.q.out b/ql/src/test/results/clientpositive/spark/ppd_join3.q.out
index c93994c..d2343c4 100644
--- a/ql/src/test/results/clientpositive/spark/ppd_join3.q.out
+++ b/ql/src/test/results/clientpositive/spark/ppd_join3.q.out
@@ -51,16 +51,19 @@ STAGE PLANS:
                       outputColumnNames: _col0
                       Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: ((_col0 <> '11') and ((_col0 > '0') and ((_col0 < '400') and ((_col0 <> '12') and (_col0 <> '4'))))) (type: boolean)
-                        Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                        predicate: (_col0 <> '1') (type: boolean)
+                        Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                         Filter Operator
-                          predicate: _col0 is not null (type: boolean)
-                          Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col0 (type: string)
-                            sort order: +
-                            Map-reduce partition columns: _col0 (type: string)
+                          predicate: ((_col0 <> '11') and ((_col0 > '0') and ((_col0 < '400') and ((_col0 <> '12') and (_col0 <> '4'))))) (type: boolean)
+                          Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                          Filter Operator
+                            predicate: _col0 is not null (type: boolean)
                             Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
+                            Reduce Output Operator
+                              key expressions: _col0 (type: string)
+                              sort order: +
+                              Map-reduce partition columns: _col0 (type: string)
+                              Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
         Map 3 
             Map Operator Tree:
                 TableScan
@@ -74,17 +77,20 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: ((_col0 <> '11') and ((_col0 > '0') and (_col0 < '400'))) (type: boolean)
-                        Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                        predicate: (_col0 <> '4') (type: boolean)
+                        Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                         Filter Operator
-                          predicate: _col0 is not null (type: boolean)
-                          Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col0 (type: string)
-                            sort order: +
-                            Map-reduce partition columns: _col0 (type: string)
+                          predicate: ((_col0 <> '11') and ((_col0 > '0') and (_col0 < '400'))) (type: boolean)
+                          Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                          Filter Operator
+                            predicate: _col0 is not null (type: boolean)
                             Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                            value expressions: _col1 (type: string)
+                            Reduce Output Operator
+                              key expressions: _col0 (type: string)
+                              sort order: +
+                              Map-reduce partition columns: _col0 (type: string)
+                              Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
+                              value expressions: _col1 (type: string)
         Map 5 
             Map Operator Tree:
                 TableScan
@@ -94,20 +100,27 @@ STAGE PLANS:
                     predicate: (((((((((key <> '11') and (key > '0')) and ((value <> 'val_500') or (key > '1'))) and (key < '400')) and (key <> '12')) and (key <> '4')) and key is not null) and (key <> '13')) and (key <> '1')) (type: boolean)
                     Statistics: Num rows: 37 Data size: 393 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), value (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 37 Data size: 393 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
-                        predicate: ((_col0 <> '12') and (_col0 <> '4')) (type: boolean)
-                        Statistics: Num rows: 37 Data size: 393 Basic stats: COMPLETE Column stats: NONE
-                        Filter Operator
-                          predicate: _col0 is not null (type: boolean)
-                          Statistics: Num rows: 19 Data size: 201 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col0 (type: string)
-                            sort order: +
-                            Map-reduce partition columns: _col0 (type: string)
-                            Statistics: Num rows: 19 Data size: 201 Basic stats: COMPLETE Column stats: NONE
+                        predicate: ((_col0 > '0') and (((_col1 <> 'val_500') or (_col0 > '1')) and (_col0 < '400'))) (type: boolean)
+                        Statistics: Num rows: 5 Data size: 53 Basic stats: COMPLETE Column stats: NONE
+                        Select Operator
+                          expressions: _col0 (type: string)
+                          outputColumnNames: _col0
+                          Statistics: Num rows: 5 Data size: 53 Basic stats: COMPLETE Column stats: NONE
+                          Filter Operator
+                            predicate: ((_col0 <> '12') and (_col0 <> '4')) (type: boolean)
+                            Statistics: Num rows: 5 Data size: 53 Basic stats: COMPLETE Column stats: NONE
+                            Filter Operator
+                              predicate: _col0 is not null (type: boolean)
+                              Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                              Reduce Output Operator
+                                key expressions: _col0 (type: string)
+                                sort order: +
+                                Map-reduce partition columns: _col0 (type: string)
+                                Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -117,14 +130,14 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
                 outputColumnNames: _col1, _col3
-                Statistics: Num rows: 11 Data size: 121 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: string), _col3 (type: string)
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 11 Data size: 121 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 11 Data size: 121 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.TextInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -138,29 +151,29 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col2 (type: string), _col0 (type: string), _col1 (type: string)
                   outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: ((_col1 > '10') or (_col0 <> '10')) (type: boolean)
-                    Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: string), _col2 (type: string)
                       outputColumnNames: _col0, _col2
-                      Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                       Filter Operator
                         predicate: ((_col0 <> '13') and (_col0 <> '1')) (type: boolean)
-                        Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                         Filter Operator
                           predicate: _col0 is not null (type: boolean)
-                          Statistics: Num rows: 10 Data size: 110 Basic stats: COMPLETE Column stats: NONE
+                          Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
                             key expressions: _col0 (type: string)
                             sort order: +
                             Map-reduce partition columns: _col0 (type: string)
-                            Statistics: Num rows: 10 Data size: 110 Basic stats: COMPLETE Column stats: NONE
+                            Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
                             value expressions: _col2 (type: string)
 
   Stage: Stage-0

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/subquery_notin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/subquery_notin.q.out b/ql/src/test/results/clientpositive/subquery_notin.q.out
index 0b6f33f..fd6d53b 100644
--- a/ql/src/test/results/clientpositive/subquery_notin.q.out
+++ b/ql/src/test/results/clientpositive/subquery_notin.q.out
@@ -1,4 +1,4 @@
-Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: -- non agg, non corr
 explain
 select * 
@@ -151,7 +151,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: select * 
 from src 
 where src.key not in  ( select key from src s1 where s1.key > '2')
@@ -285,7 +285,7 @@ POSTHOOK: Input: default@src
 199	val_199
 199	val_199
 2	val_2
-Warning: Shuffle Join JOIN[29][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[31][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: -- non agg, corr
 explain
 select p_mfgr, b.p_name, p_size 
@@ -528,7 +528,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[29][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[31][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: select p_mfgr, b.p_name, p_size 
 from part b 
 where b.p_name not in 
@@ -1243,7 +1243,7 @@ Manufacturer#5	almond antique medium spring khaki	6
 Manufacturer#5	almond azure blanched chiffon midnight	23
 Manufacturer#5	almond antique blue firebrick mint	31
 Manufacturer#5	almond aquamarine dodger light gainsboro	46
-Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: -- non agg, non corr, Group By in Parent Query
 select li.l_partkey, count(*) 
 from lineitem li 
@@ -1278,7 +1278,7 @@ POSTHOOK: Input: default@lineitem
 139636	1
 175839	1
 182052	1
-Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: -- alternate not in syntax
 select * 
 from src 
@@ -1442,7 +1442,7 @@ POSTHOOK: Input: default@src
 POSTHOOK: Input: default@t1_v
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@T2_v
-Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[25][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: explain
 select * 
 from T1_v where T1_v.key not in (select T2_v.key from T2_v)
@@ -1587,7 +1587,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[25][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: select * 
 from T1_v where T1_v.key not in (select T2_v.key from T2_v)
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/subquery_notin_having.q.java1.7.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/subquery_notin_having.q.java1.7.out b/ql/src/test/results/clientpositive/subquery_notin_having.q.java1.7.out
index 24c56bd..c32504e 100644
--- a/ql/src/test/results/clientpositive/subquery_notin_having.q.java1.7.out
+++ b/ql/src/test/results/clientpositive/subquery_notin_having.q.java1.7.out
@@ -1,4 +1,4 @@
-Warning: Shuffle Join JOIN[24][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[26][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: -- non agg, non corr
 -- JAVA_VERSION_SPECIFIC_OUTPUT
 
@@ -188,7 +188,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[34][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[36][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: -- non agg, corr
 explain
 select b.p_mfgr, min(p_retailprice) 
@@ -335,7 +335,7 @@ STAGE PLANS:
               outputColumnNames: _col0, _col1
               Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
               Group By Operator
-                aggregations: max(_col1), min(_col1)
+                aggregations: min(_col1), max(_col1)
                 keys: _col0 (type: string)
                 mode: hash
                 outputColumnNames: _col0, _col1, _col2
@@ -348,13 +348,13 @@ STAGE PLANS:
                   value expressions: _col1 (type: double), _col2 (type: double)
       Reduce Operator Tree:
         Group By Operator
-          aggregations: max(VALUE._col0), min(VALUE._col1)
+          aggregations: min(VALUE._col0), max(VALUE._col1)
           keys: KEY._col0 (type: string)
           mode: mergepartial
           outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((_col0 is null or _col2 is null) and ((_col1 - _col2) > 600.0)) (type: boolean)
+            predicate: ((_col0 is null or _col1 is null) and ((_col2 - _col1) > 600.0)) (type: boolean)
             Statistics: Num rows: 2 Data size: 242 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               Statistics: Num rows: 2 Data size: 242 Basic stats: COMPLETE Column stats: NONE
@@ -445,7 +445,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[34][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[36][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: select b.p_mfgr, min(p_retailprice) 
 from part b 
 group by b.p_mfgr
@@ -470,7 +470,7 @@ POSTHOOK: Input: default@part
 #### A masked pattern was here ####
 Manufacturer#1	1173.15
 Manufacturer#2	1690.68
-Warning: Shuffle Join JOIN[38][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-3:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[39][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-3:MAPRED' is a cross product
 PREHOOK: query: -- agg, non corr
 explain
 select b.p_mfgr, min(p_retailprice) 
@@ -729,7 +729,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[38][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-3:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[39][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-3:MAPRED' is a cross product
 PREHOOK: query: select b.p_mfgr, min(p_retailprice) 
 from part b 
 group by b.p_mfgr

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/subquery_unqualcolumnrefs.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/subquery_unqualcolumnrefs.q.out b/ql/src/test/results/clientpositive/subquery_unqualcolumnrefs.q.out
index c393e4b..2256f6e 100644
--- a/ql/src/test/results/clientpositive/subquery_unqualcolumnrefs.q.out
+++ b/ql/src/test/results/clientpositive/subquery_unqualcolumnrefs.q.out
@@ -781,7 +781,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[29][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[31][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: -- non agg, corr
 explain
 select p_mfgr, b.p_name, p_size 

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/subquery_views.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/subquery_views.q.out b/ql/src/test/results/clientpositive/subquery_views.q.out
index bdab9ea..41834a3 100644
--- a/ql/src/test/results/clientpositive/subquery_views.q.out
+++ b/ql/src/test/results/clientpositive/subquery_views.q.out
@@ -69,8 +69,8 @@ POSTHOOK: type: CREATEVIEW
 POSTHOOK: Input: default@src
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@cv2
-Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
-Warning: Shuffle Join JOIN[46][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-6:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[50][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-6:MAPRED' is a cross product
 PREHOOK: query: explain
 select * 
 from cv2 where cv2.key in (select key from cv2 c where c.key < '11')
@@ -378,8 +378,8 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
-Warning: Shuffle Join JOIN[46][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-6:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[21][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[50][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-6:MAPRED' is a cross product
 PREHOOK: query: select * 
 from cv2 where cv2.key in (select key from cv2 c where c.key < '11')
 PREHOOK: type: QUERY


[3/3] hive git commit: HIVE-9069: Simplify filter predicates for CBO (Jesus Camacho Rodriguez, reviewed by Laljo John Pullokkaran)

Posted by jc...@apache.org.
HIVE-9069: Simplify filter predicates for CBO (Jesus Camacho Rodriguez, reviewed by Laljo John Pullokkaran)


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

Branch: refs/heads/branch-1
Commit: e2f1caf39484fe9fc7c1598a2dcff0a459f16148
Parents: 14c5e44
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Mon Aug 10 13:37:06 2015 +0300
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Mon Aug 10 13:37:06 2015 +0300

----------------------------------------------------------------------
 .../calcite/rules/HivePreFilteringRule.java     | 218 +++++++
 .../hadoop/hive/ql/parse/CalcitePlanner.java    |  16 +-
 .../clientpositive/filter_cond_pushdown.q       |  19 +
 .../results/clientpositive/auto_join16.q.out    |   4 +-
 .../results/clientpositive/auto_join8.q.out     |  14 +-
 .../clientpositive/cbo_rp_auto_join1.q.out      |   4 +-
 .../clientpositive/explain_logical.q.out        |  22 +-
 .../clientpositive/filter_cond_pushdown.q.out   | 382 ++++++++++++
 ql/src/test/results/clientpositive/join8.q.out  |  16 +-
 .../list_bucket_query_oneskew_2.q.out           |   2 +-
 .../test/results/clientpositive/ppd_gby.q.out   |  41 +-
 .../test/results/clientpositive/ppd_gby2.q.out  |  49 +-
 .../results/clientpositive/ppd_gby_join.q.out   |  42 +-
 .../test/results/clientpositive/ppd_join.q.out  |  44 +-
 .../test/results/clientpositive/ppd_join2.q.out |  81 +--
 .../test/results/clientpositive/ppd_join3.q.out |  91 +--
 .../results/clientpositive/ppd_udf_col.q.out    | 178 +++---
 .../test/results/clientpositive/ppd_union.q.out |  42 +-
 ql/src/test/results/clientpositive/ppd_vc.q.out |   8 +-
 .../clientpositive/spark/ppd_join2.q.out        |  81 +--
 .../clientpositive/spark/ppd_join3.q.out        |  91 +--
 .../results/clientpositive/subquery_notin.q.out |  16 +-
 .../subquery_notin_having.q.java1.7.out         |  16 +-
 .../subquery_unqualcolumnrefs.q.out             |   2 +-
 .../results/clientpositive/subquery_views.q.out |   8 +-
 .../clientpositive/tez/explainuser_1.q.out      | 592 +++++++++----------
 26 files changed, 1411 insertions(+), 668 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePreFilteringRule.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePreFilteringRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePreFilteringRule.java
new file mode 100644
index 0000000..dde6288
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePreFilteringRule.java
@@ -0,0 +1,218 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.optimizer.calcite.rules;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.calcite.plan.RelOptPredicateList;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.Filter;
+import org.apache.calcite.rel.core.RelFactories.FilterFactory;
+import org.apache.calcite.rel.core.TableScan;
+import org.apache.calcite.rel.metadata.RelMetadataQuery;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexUtil;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveFilter;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFBetween;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualNS;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotEqual;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.LinkedHashMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
+
+
+public class HivePreFilteringRule extends RelOptRule {
+
+  protected static final Log LOG = LogFactory
+          .getLog(HivePreFilteringRule.class.getName());
+
+
+  public static final HivePreFilteringRule INSTANCE =
+          new HivePreFilteringRule();
+
+  private final FilterFactory filterFactory;
+
+
+  private static final Set<String> COMPARISON_UDFS = Sets.newHashSet(
+          GenericUDFOPEqual.class.getAnnotation(Description.class).name(),
+          GenericUDFOPEqualNS.class.getAnnotation(Description.class).name(),
+          GenericUDFOPEqualOrGreaterThan.class.getAnnotation(Description.class).name(),
+          GenericUDFOPEqualOrLessThan.class.getAnnotation(Description.class).name(),
+          GenericUDFOPGreaterThan.class.getAnnotation(Description.class).name(),
+          GenericUDFOPLessThan.class.getAnnotation(Description.class).name(),
+          GenericUDFOPNotEqual.class.getAnnotation(Description.class).name());
+  private static final String IN_UDF =
+          GenericUDFIn.class.getAnnotation(Description.class).name();
+  private static final String BETWEEN_UDF =
+          GenericUDFBetween.class.getAnnotation(Description.class).name();
+
+
+  private HivePreFilteringRule() {
+    super(operand(Filter.class,
+            operand(RelNode.class, any())));
+    this.filterFactory = HiveFilter.DEFAULT_FILTER_FACTORY;
+  }
+
+  public void onMatch(RelOptRuleCall call) {
+    final Filter filter = call.rel(0);
+    final RelNode filterChild = call.rel(1);
+
+    // 0. If the filter is already on top of a TableScan,
+    //    we can bail out
+    if (filterChild instanceof TableScan) {
+      return;
+    }
+
+    final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
+
+    final RexNode condition = RexUtil.pullFactors(rexBuilder, filter.getCondition());
+
+    // 1. We extract possible candidates to be pushed down
+    List<RexNode> commonOperands = new ArrayList<>();
+    switch (condition.getKind()) {
+      case AND:
+        ImmutableList<RexNode> operands = RexUtil.flattenAnd(((RexCall) condition).getOperands());
+        for (RexNode operand: operands) {
+          if (operand.getKind() == SqlKind.OR) {
+            commonOperands.addAll(extractCommonOperands(rexBuilder,operand));
+          }
+        }
+        break;
+      case OR:
+        commonOperands = extractCommonOperands(rexBuilder,condition);
+        break;
+      default:
+        return;
+    }
+
+    // 2. If we did not generate anything for the new predicate, we bail out
+    if (commonOperands.isEmpty()) {
+      return;
+    }
+
+    // 3. If the new conjuncts are already present in the plan, we bail out
+    final RelOptPredicateList predicates = RelMetadataQuery.getPulledUpPredicates(filter);
+    final List<RexNode> newConjuncts = new ArrayList<>();
+    for (RexNode commonOperand : commonOperands) {
+      boolean found = false;
+      for (RexNode conjunct : predicates.pulledUpPredicates) {
+        if (commonOperand.toString().equals(conjunct.toString())) {
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        newConjuncts.add(commonOperand);
+      }
+    }
+    if (newConjuncts.isEmpty()) {
+      return;
+    }
+
+    // 4. Otherwise, we create a new condition
+    final RexNode newCondition = RexUtil.pullFactors(rexBuilder,
+            RexUtil.composeConjunction(rexBuilder, newConjuncts, false));
+
+    // 5. We create the new filter that might be pushed down
+    RelNode newFilter = filterFactory.createFilter(filterChild, newCondition);
+    RelNode newTopFilter = filterFactory.createFilter(newFilter, condition);
+
+    call.transformTo(newTopFilter);
+
+  }
+
+  private static List<RexNode> extractCommonOperands(RexBuilder rexBuilder, RexNode condition) {
+    assert condition.getKind() == SqlKind.OR;
+    Multimap<String,RexNode> reductionCondition = LinkedHashMultimap.create();
+
+    // 1. We extract the information necessary to create the predicate for the new
+    //    filter; currently we support comparison functions, in and between
+    ImmutableList<RexNode> operands = RexUtil.flattenOr(((RexCall) condition).getOperands());
+    for (RexNode operand: operands) {
+      final RexNode operandCNF = RexUtil.toCnf(rexBuilder, operand);
+      final List<RexNode> conjunctions = RelOptUtil.conjunctions(operandCNF);
+      boolean addedToReductionCondition = false; // Flag to control whether we have added a new factor
+                                                 // to the reduction predicate
+      for (RexNode conjunction: conjunctions) {
+        if (!(conjunction instanceof RexCall)) {
+          continue;
+        }
+        RexCall conjCall = (RexCall) conjunction;
+        if(COMPARISON_UDFS.contains(conjCall.getOperator().getName())) {
+          if (conjCall.operands.get(0) instanceof RexInputRef &&
+                  conjCall.operands.get(1) instanceof RexLiteral) {
+            reductionCondition.put(conjCall.operands.get(0).toString(),
+                    conjCall);
+            addedToReductionCondition = true;
+          } else if (conjCall.operands.get(1) instanceof RexInputRef &&
+                  conjCall.operands.get(0) instanceof RexLiteral) {
+            reductionCondition.put(conjCall.operands.get(1).toString(),
+                    conjCall);
+            addedToReductionCondition = true;
+          }
+        } else if(conjCall.getOperator().getName().equals(IN_UDF)) {
+          reductionCondition.put(conjCall.operands.get(0).toString(),
+                  conjCall);
+          addedToReductionCondition = true;
+        } else if(conjCall.getOperator().getName().equals(BETWEEN_UDF)) {
+          reductionCondition.put(conjCall.operands.get(1).toString(),
+                  conjCall);
+          addedToReductionCondition = true;
+        }
+      }
+
+      // If we did not add any factor, we can bail out
+      if (!addedToReductionCondition) {
+        return new ArrayList<>();
+      }
+    }
+
+    // 2. We gather the common factors and return them
+    List<RexNode> commonOperands = new ArrayList<>();
+    for (Entry<String,Collection<RexNode>> pair : reductionCondition.asMap().entrySet()) {
+      if (pair.getValue().size() == operands.size()) {
+        commonOperands.add(RexUtil.composeDisjunction(rexBuilder, pair.getValue(), false));
+      }
+    }
+    return commonOperands;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
index 130d525..38f2014 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
@@ -144,6 +144,7 @@ import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveInsertExchange4Join
 import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveJoinAddNotNullRule;
 import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveJoinToMultiJoinRule;
 import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HivePartitionPruneRule;
+import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HivePreFilteringRule;
 import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveRelFieldTrimmer;
 import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveWindowingFixRule;
 import org.apache.hadoop.hive.ql.optimizer.calcite.translator.ASTConverter;
@@ -937,17 +938,18 @@ public class CalcitePlanner extends SemanticAnalyzer {
         basePlan = hepPlan(basePlan, true, mdProvider, HiveJoinAddNotNullRule.INSTANCE);
       }
 
-      // 3. PPD
+      // 3. Constant propagation, common filter extraction, and PPD
       basePlan = hepPlan(basePlan, true, mdProvider,
           ReduceExpressionsRule.PROJECT_INSTANCE,
           ReduceExpressionsRule.FILTER_INSTANCE,
           ReduceExpressionsRule.JOIN_INSTANCE,
-          new HiveFilterProjectTransposeRule(
-          Filter.class, HiveFilter.DEFAULT_FILTER_FACTORY, HiveProject.class,
-          HiveProject.DEFAULT_PROJECT_FACTORY), new HiveFilterSetOpTransposeRule(
-          HiveFilter.DEFAULT_FILTER_FACTORY),
-          new FilterMergeRule(HiveFilter.DEFAULT_FILTER_FACTORY), HiveFilterJoinRule.JOIN,
-          HiveFilterJoinRule.FILTER_ON_JOIN, new FilterAggregateTransposeRule(Filter.class,
+          HivePreFilteringRule.INSTANCE,
+          new HiveFilterProjectTransposeRule(Filter.class, HiveFilter.DEFAULT_FILTER_FACTORY,
+                  HiveProject.class, HiveProject.DEFAULT_PROJECT_FACTORY),
+          new HiveFilterSetOpTransposeRule(HiveFilter.DEFAULT_FILTER_FACTORY),
+          HiveFilterJoinRule.JOIN,
+          HiveFilterJoinRule.FILTER_ON_JOIN,
+          new FilterAggregateTransposeRule(Filter.class,
               HiveFilter.DEFAULT_FILTER_FACTORY, Aggregate.class));
 
       // 4. Transitive inference & Partition Pruning

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/queries/clientpositive/filter_cond_pushdown.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/filter_cond_pushdown.q b/ql/src/test/queries/clientpositive/filter_cond_pushdown.q
new file mode 100644
index 0000000..5e23b71
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/filter_cond_pushdown.q
@@ -0,0 +1,19 @@
+EXPLAIN
+SELECT f.key, g.value
+FROM src f JOIN src m JOIN src g ON(g.value = m.value AND m.value is not null AND m.value !='')
+WHERE (f.key = m.key AND f.value='2008-04-08' AND m.value='2008-04-08') OR (f.key = m.key AND f.value='2008-04-09');
+
+EXPLAIN
+SELECT f.key, g.value
+FROM src f JOIN src m JOIN src g ON(g.value = m.value AND m.value is not null AND m.value !='')
+WHERE (f.key = m.key AND f.value IN ('2008-04-08','2008-04-10') AND m.value='2008-04-08') OR (f.key = m.key AND f.value='2008-04-09');
+
+EXPLAIN
+SELECT t1.key 
+FROM cbo_t1 t1
+JOIN (
+  SELECT t2.key
+  FROM cbo_t2 t2
+  JOIN (SELECT * FROM cbo_t3 t3 WHERE c_int=1) t3 ON t2.key=t3.c_int
+  WHERE ((t2.key=t3.key) AND (t2.c_float + t3.c_float > 2)) OR
+      ((t2.key=t3.key) AND (t2.c_int + t3.c_int > 2))) t4 ON t1.key=t4.key;

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/auto_join16.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join16.q.out b/ql/src/test/results/clientpositive/auto_join16.q.out
index b07eaf6..1bad0f9 100644
--- a/ql/src/test/results/clientpositive/auto_join16.q.out
+++ b/ql/src/test/results/clientpositive/auto_join16.q.out
@@ -23,11 +23,11 @@ STAGE PLANS:
   Stage: Stage-5
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_0:$hdt$_0:$hdt$_0:a 
+        $hdt$_0:$hdt$_0:$hdt$_0:$hdt$_0:a 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_0:$hdt$_0:$hdt$_0:a 
+        $hdt$_0:$hdt$_0:$hdt$_0:$hdt$_0:a 
           TableScan
             alias: a
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/auto_join8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join8.q.out b/ql/src/test/results/clientpositive/auto_join8.q.out
index f0cb77b..2ca26aa 100644
--- a/ql/src/test/results/clientpositive/auto_join8.q.out
+++ b/ql/src/test/results/clientpositive/auto_join8.q.out
@@ -73,12 +73,12 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) > 10.0) and (UDFToDouble(key) < 20.0)) (type: boolean)
-              Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
+              predicate: (((UDFToDouble(key) > 10.0) and (UDFToDouble(key) < 20.0)) and key is not null) (type: boolean)
+              Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Left Outer Join0 to 1
@@ -86,17 +86,17 @@ STAGE PLANS:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3
-                  Statistics: Num rows: 60 Data size: 642 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: _col2 is null (type: boolean)
-                    Statistics: Num rows: 30 Data size: 321 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: UDFToInteger(_col0) (type: int), _col1 (type: string), null (type: int), _col3 (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 30 Data size: 321 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
                       File Output Operator
                         compressed: false
-                        Statistics: Num rows: 30 Data size: 321 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
                         table:
                             input format: org.apache.hadoop.mapred.TextInputFormat
                             output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/cbo_rp_auto_join1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_rp_auto_join1.q.out b/ql/src/test/results/clientpositive/cbo_rp_auto_join1.q.out
index 2e23197..f4b25ae 100644
--- a/ql/src/test/results/clientpositive/cbo_rp_auto_join1.q.out
+++ b/ql/src/test/results/clientpositive/cbo_rp_auto_join1.q.out
@@ -610,7 +610,7 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: a
+            alias: b
             Statistics: Num rows: 10 Data size: 70 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
               predicate: (((key < 8) and (key < 6)) and key is not null) (type: boolean)
@@ -1277,7 +1277,7 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: a
+            alias: b
             Statistics: Num rows: 10 Data size: 70 Basic stats: COMPLETE Column stats: COMPLETE
             Filter Operator
               predicate: (((key < 8) and (key < 6)) and key is not null) (type: boolean)

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/explain_logical.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/explain_logical.q.out b/ql/src/test/results/clientpositive/explain_logical.q.out
index 831535e..545034a 100644
--- a/ql/src/test/results/clientpositive/explain_logical.q.out
+++ b/ql/src/test/results/clientpositive/explain_logical.q.out
@@ -503,23 +503,23 @@ TOK_QUERY
 
 
 LOGICAL PLAN:
-$hdt$_0:srcpart 
+$hdt$_0:$hdt$_0:srcpart 
   TableScan (TS_0)
     alias: srcpart
     Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
-    Filter Operator (FIL_12)
+    Filter Operator (FIL_14)
       predicate: key is not null (type: boolean)
       Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column stats: NONE
       Select Operator (SEL_2)
         expressions: key (type: string)
         outputColumnNames: _col0
         Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column stats: NONE
-        Reduce Output Operator (RS_6)
+        Reduce Output Operator (RS_8)
           key expressions: _col0 (type: string)
           sort order: +
           Map-reduce partition columns: _col0 (type: string)
           Statistics: Num rows: 1000 Data size: 10624 Basic stats: COMPLETE Column stats: NONE
-          Join Operator (JOIN_9)
+          Join Operator (JOIN_11)
             condition map:
                  Inner Join 0 to 1
             keys:
@@ -527,11 +527,11 @@ $hdt$_0:srcpart
               1 _col0 (type: string)
             outputColumnNames: _col0, _col2
             Statistics: Num rows: 1100 Data size: 11686 Basic stats: COMPLETE Column stats: NONE
-            Select Operator (SEL_10)
+            Select Operator (SEL_12)
               expressions: _col0 (type: string), _col2 (type: string)
               outputColumnNames: _col0, _col1
               Statistics: Num rows: 1100 Data size: 11686 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator (FS_11)
+              File Output Operator (FS_13)
                 compressed: false
                 Statistics: Num rows: 1100 Data size: 11686 Basic stats: COMPLETE Column stats: NONE
                 table:
@@ -539,23 +539,23 @@ $hdt$_0:srcpart
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
                     serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 $hdt$_1:src2 
-  TableScan (TS_3)
+  TableScan (TS_5)
     alias: src2
     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-    Filter Operator (FIL_13)
+    Filter Operator (FIL_15)
       predicate: key is not null (type: boolean)
       Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-      Select Operator (SEL_4)
+      Select Operator (SEL_6)
         expressions: key (type: string), value (type: string)
         outputColumnNames: _col0, _col1
         Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-        Reduce Output Operator (RS_8)
+        Reduce Output Operator (RS_10)
           key expressions: _col0 (type: string)
           sort order: +
           Map-reduce partition columns: _col0 (type: string)
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
           value expressions: _col1 (type: string)
-          Join Operator (JOIN_9)
+          Join Operator (JOIN_11)
             condition map:
                  Inner Join 0 to 1
             keys:

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out b/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
new file mode 100644
index 0000000..e09057a
--- /dev/null
+++ b/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
@@ -0,0 +1,382 @@
+PREHOOK: query: EXPLAIN
+SELECT f.key, g.value
+FROM src f JOIN src m JOIN src g ON(g.value = m.value AND m.value is not null AND m.value !='')
+WHERE (f.key = m.key AND f.value='2008-04-08' AND m.value='2008-04-08') OR (f.key = m.key AND f.value='2008-04-09')
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT f.key, g.value
+FROM src f JOIN src m JOIN src g ON(g.value = m.value AND m.value is not null AND m.value !='')
+WHERE (f.key = m.key AND f.value='2008-04-08' AND m.value='2008-04-08') OR (f.key = m.key AND f.value='2008-04-09')
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: f
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (((value = '2008-04-08') or (value = '2008-04-09')) and key is not null) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
+          TableScan
+            alias: f
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (((value <> '') and key is not null) and value is not null) (type: boolean)
+              Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col0 (type: string)
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+          Filter Operator
+            predicate: (((_col1 = '2008-04-08') and (_col3 = '2008-04-08')) or (_col1 = '2008-04-09')) (type: boolean)
+            Statistics: Num rows: 205 Data size: 2177 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: _col0 (type: string), _col3 (type: string)
+              outputColumnNames: _col0, _col3
+              Statistics: Num rows: 205 Data size: 2177 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col3 (type: string)
+              sort order: +
+              Map-reduce partition columns: _col3 (type: string)
+              Statistics: Num rows: 205 Data size: 2177 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: string)
+          TableScan
+            alias: f
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (value <> '') (type: boolean)
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: value (type: string)
+                outputColumnNames: _col0
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col3 (type: string)
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col4
+          Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: _col0 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: EXPLAIN
+SELECT f.key, g.value
+FROM src f JOIN src m JOIN src g ON(g.value = m.value AND m.value is not null AND m.value !='')
+WHERE (f.key = m.key AND f.value IN ('2008-04-08','2008-04-10') AND m.value='2008-04-08') OR (f.key = m.key AND f.value='2008-04-09')
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT f.key, g.value
+FROM src f JOIN src m JOIN src g ON(g.value = m.value AND m.value is not null AND m.value !='')
+WHERE (f.key = m.key AND f.value IN ('2008-04-08','2008-04-10') AND m.value='2008-04-08') OR (f.key = m.key AND f.value='2008-04-09')
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: f
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (((value) IN ('2008-04-08', '2008-04-10') or (value = '2008-04-09')) and key is not null) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
+          TableScan
+            alias: f
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (((value <> '') and key is not null) and value is not null) (type: boolean)
+              Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col0 (type: string)
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+          Filter Operator
+            predicate: (((_col1) IN ('2008-04-08', '2008-04-10') and (_col3 = '2008-04-08')) or (_col1 = '2008-04-09')) (type: boolean)
+            Statistics: Num rows: 205 Data size: 2177 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: _col0 (type: string), _col3 (type: string)
+              outputColumnNames: _col0, _col3
+              Statistics: Num rows: 205 Data size: 2177 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col3 (type: string)
+              sort order: +
+              Map-reduce partition columns: _col3 (type: string)
+              Statistics: Num rows: 205 Data size: 2177 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: string)
+          TableScan
+            alias: f
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (value <> '') (type: boolean)
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: value (type: string)
+                outputColumnNames: _col0
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col3 (type: string)
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col4
+          Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: _col0 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: EXPLAIN
+SELECT t1.key 
+FROM cbo_t1 t1
+JOIN (
+  SELECT t2.key
+  FROM cbo_t2 t2
+  JOIN (SELECT * FROM cbo_t3 t3 WHERE c_int=1) t3 ON t2.key=t3.c_int
+  WHERE ((t2.key=t3.key) AND (t2.c_float + t3.c_float > 2)) OR
+      ((t2.key=t3.key) AND (t2.c_int + t3.c_int > 2))) t4 ON t1.key=t4.key
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT t1.key 
+FROM cbo_t1 t1
+JOIN (
+  SELECT t2.key
+  FROM cbo_t2 t2
+  JOIN (SELECT * FROM cbo_t3 t3 WHERE c_int=1) t3 ON t2.key=t3.c_int
+  WHERE ((t2.key=t3.key) AND (t2.c_float + t3.c_float > 2)) OR
+      ((t2.key=t3.key) AND (t2.c_int + t3.c_int > 2))) t4 ON t1.key=t4.key
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-2 is a root stage
+  Stage-1 depends on stages: Stage-2
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t2
+            Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (UDFToDouble(key) = 1.0) (type: boolean)
+              Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: c_int (type: int), c_float (type: float)
+                outputColumnNames: _col1, _col2
+                Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: '1.0' (type: string)
+                  sort order: +
+                  Map-reduce partition columns: '1.0' (type: string)
+                  Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col2 (type: float)
+          TableScan
+            alias: t3
+            Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: ((c_int = 1) and (UDFToDouble(key) = 1.0)) (type: boolean)
+              Statistics: Num rows: 5 Data size: 65 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                expressions: c_float (type: float)
+                outputColumnNames: _col2
+                Statistics: Num rows: 5 Data size: 65 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: '1.0' (type: string)
+                  sort order: +
+                  Map-reduce partition columns: '1.0' (type: string)
+                  Statistics: Num rows: 5 Data size: 65 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col2 (type: float)
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col0 (type: string)
+            1 _col0 (type: string)
+          outputColumnNames: _col1, _col2, _col5
+          Statistics: Num rows: 11 Data size: 144 Basic stats: COMPLETE Column stats: NONE
+          Filter Operator
+            predicate: (((_col2 + _col5) > 2.0) or ((_col1 + 1) > 2)) (type: boolean)
+            Statistics: Num rows: 6 Data size: 78 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              Statistics: Num rows: 6 Data size: 78 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t1
+            Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
+            Filter Operator
+              predicate: (UDFToDouble(key) = 1.0) (type: boolean)
+              Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
+              Select Operator
+                Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: '1.0' (type: string)
+                  sort order: +
+                  Map-reduce partition columns: '1.0' (type: string)
+                  Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
+          TableScan
+            Reduce Output Operator
+              key expressions: '1.0' (type: string)
+              sort order: +
+              Map-reduce partition columns: '1.0' (type: string)
+              Statistics: Num rows: 6 Data size: 78 Basic stats: COMPLETE Column stats: NONE
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col0 (type: string)
+            1 _col0 (type: string)
+          Statistics: Num rows: 11 Data size: 144 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: '1.0' (type: string)
+            outputColumnNames: _col0
+            Statistics: Num rows: 11 Data size: 144 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 11 Data size: 144 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/join8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join8.q.out b/ql/src/test/results/clientpositive/join8.q.out
index 493341d..6ff3e33 100644
--- a/ql/src/test/results/clientpositive/join8.q.out
+++ b/ql/src/test/results/clientpositive/join8.q.out
@@ -53,17 +53,17 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) > 10.0) and (UDFToDouble(key) < 20.0)) (type: boolean)
-              Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
+              predicate: (((UDFToDouble(key) > 10.0) and (UDFToDouble(key) < 20.0)) and key is not null) (type: boolean)
+              Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: string)
           TableScan
             alias: src1
@@ -89,17 +89,17 @@ STAGE PLANS:
             0 _col0 (type: string)
             1 _col0 (type: string)
           outputColumnNames: _col0, _col1, _col2, _col3
-          Statistics: Num rows: 60 Data size: 642 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
             predicate: _col2 is null (type: boolean)
-            Statistics: Num rows: 30 Data size: 321 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: UDFToInteger(_col0) (type: int), _col1 (type: string), null (type: int), _col3 (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3
-              Statistics: Num rows: 30 Data size: 321 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
               File Output Operator
                 compressed: false
-                Statistics: Num rows: 30 Data size: 321 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
                 table:
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/list_bucket_query_oneskew_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/list_bucket_query_oneskew_2.q.out b/ql/src/test/results/clientpositive/list_bucket_query_oneskew_2.q.out
index aab5506..177da44 100644
--- a/ql/src/test/results/clientpositive/list_bucket_query_oneskew_2.q.out
+++ b/ql/src/test/results/clientpositive/list_bucket_query_oneskew_2.q.out
@@ -758,7 +758,7 @@ STAGE PLANS:
               name: default.fact_daily
             name: default.fact_daily
       Truncated Path -> Alias:
-        /fact_tz/ds=1/x=484 [$hdt$_0:fact_daily]
+        /fact_tz/ds=1/x=484 [$hdt$_0:$hdt$_0:fact_daily]
       Needs Tagging: false
       Reduce Operator Tree:
         Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_gby.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_gby.q.out b/ql/src/test/results/clientpositive/ppd_gby.q.out
index 523842e..87cb907 100644
--- a/ql/src/test/results/clientpositive/ppd_gby.q.out
+++ b/ql/src/test/results/clientpositive/ppd_gby.q.out
@@ -25,38 +25,45 @@ STAGE PLANS:
               predicate: ((value > 'val_10') and (value > 'val_200')) (type: boolean)
               Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: value (type: string), key (type: string)
+                expressions: key (type: string), value (type: string)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
-                Group By Operator
-                  aggregations: count(_col1)
-                  keys: _col0 (type: string)
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: bigint)
+                Filter Operator
+                  predicate: (_col1 > 'val_200') (type: boolean)
+                  Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col1 (type: string), _col0 (type: string)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: count(_col1)
+                      keys: _col0 (type: string)
+                      mode: hash
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: bigint)
       Reduce Operator Tree:
         Group By Operator
           aggregations: count(VALUE._col0)
           keys: KEY._col0 (type: string)
           mode: mergepartial
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 9 Data size: 95 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
             predicate: ((_col1 > 30) or (_col0 < 'val_400')) (type: boolean)
-            Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col0 (type: string)
               outputColumnNames: _col0
-              Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
               File Output Operator
                 compressed: false
-                Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
                 table:
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_gby2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_gby2.q.out b/ql/src/test/results/clientpositive/ppd_gby2.q.out
index 1ee4b49..bc00149 100644
--- a/ql/src/test/results/clientpositive/ppd_gby2.q.out
+++ b/ql/src/test/results/clientpositive/ppd_gby2.q.out
@@ -28,41 +28,48 @@ STAGE PLANS:
               predicate: ((value > 'val_10') and (value > 'val_200')) (type: boolean)
               Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: value (type: string), key (type: string)
+                expressions: key (type: string), value (type: string)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
-                Group By Operator
-                  aggregations: count(_col1)
-                  keys: _col0 (type: string)
-                  mode: hash
-                  outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: bigint)
+                Filter Operator
+                  predicate: (_col1 > 'val_200') (type: boolean)
+                  Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col1 (type: string), _col0 (type: string)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: count(_col1)
+                      keys: _col0 (type: string)
+                      mode: hash
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 18 Data size: 191 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: bigint)
       Reduce Operator Tree:
         Group By Operator
           aggregations: count(VALUE._col0)
           keys: KEY._col0 (type: string)
           mode: mergepartial
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 9 Data size: 95 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
             predicate: ((_col1 > 30) or (_col0 < 'val_400')) (type: boolean)
-            Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col1 (type: bigint), _col0 (type: string)
               outputColumnNames: _col0, _col1
-              Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
               Group By Operator
                 aggregations: max(_col1)
                 keys: _col0 (type: bigint)
                 mode: hash
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
                   compressed: false
                   table:
@@ -78,7 +85,7 @@ STAGE PLANS:
               key expressions: _col0 (type: bigint)
               sort order: +
               Map-reduce partition columns: _col0 (type: bigint)
-              Statistics: Num rows: 18 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 6 Data size: 63 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Group By Operator
@@ -86,14 +93,14 @@ STAGE PLANS:
           keys: KEY._col0 (type: bigint)
           mode: mergepartial
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 9 Data size: 95 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col1 (type: string), _col0 (type: bigint)
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 9 Data size: 95 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 9 Data size: 95 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.TextInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_gby_join.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_gby_join.q.out b/ql/src/test/results/clientpositive/ppd_gby_join.q.out
index 60ae8f9..579c827 100644
--- a/ql/src/test/results/clientpositive/ppd_gby_join.q.out
+++ b/ql/src/test/results/clientpositive/ppd_gby_join.q.out
@@ -42,16 +42,19 @@ STAGE PLANS:
                 outputColumnNames: _col0
                 Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 > '1') and ((_col0 > '20') and (_col0 < '400'))) (type: boolean)
-                  Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (_col0 <> '4') (type: boolean)
+                  Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: _col0 is not null (type: boolean)
+                    predicate: ((_col0 > '1') and ((_col0 > '20') and (_col0 < '400'))) (type: boolean)
                     Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
                       Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
@@ -59,20 +62,27 @@ STAGE PLANS:
               predicate: (((((((key > '1') and (key > '20')) and ((value < 'val_50') or (key > '2'))) and (key < '400')) and (key > '2')) and (key <> '4')) and key is not null) (type: boolean)
               Statistics: Num rows: 2 Data size: 21 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 2 Data size: 21 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 > '2') and (_col0 <> '4')) (type: boolean)
+                  predicate: ((_col0 > '20') and (((_col1 < 'val_50') or (_col0 > '2')) and (_col0 < '400'))) (type: boolean)
                   Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: _col0 is not null (type: boolean)
+                  Select Operator
+                    expressions: _col0 (type: string)
+                    outputColumnNames: _col0
                     Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    Filter Operator
+                      predicate: ((_col0 > '2') and (_col0 <> '4')) (type: boolean)
                       Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                      Filter Operator
+                        predicate: _col0 is not null (type: boolean)
+                        Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_join.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_join.q.out b/ql/src/test/results/clientpositive/ppd_join.q.out
index 8fde2d7..ae5fb27 100644
--- a/ql/src/test/results/clientpositive/ppd_join.q.out
+++ b/ql/src/test/results/clientpositive/ppd_join.q.out
@@ -39,17 +39,20 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 > '1') and ((_col0 > '20') and (_col0 < '400'))) (type: boolean)
-                  Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (_col0 <> '4') (type: boolean)
+                  Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: _col0 is not null (type: boolean)
+                    predicate: ((_col0 > '1') and ((_col0 > '20') and (_col0 < '400'))) (type: boolean)
                     Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
                       Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: string)
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
@@ -57,20 +60,27 @@ STAGE PLANS:
               predicate: (((((((key > '1') and (key > '20')) and ((value < 'val_50') or (key > '2'))) and (key < '400')) and (key > '2')) and (key <> '4')) and key is not null) (type: boolean)
               Statistics: Num rows: 2 Data size: 21 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 2 Data size: 21 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 > '2') and (_col0 <> '4')) (type: boolean)
+                  predicate: ((_col0 > '20') and (((_col1 < 'val_50') or (_col0 > '2')) and (_col0 < '400'))) (type: boolean)
                   Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: _col0 is not null (type: boolean)
+                  Select Operator
+                    expressions: _col0 (type: string)
+                    outputColumnNames: _col0
                     Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    Filter Operator
+                      predicate: ((_col0 > '2') and (_col0 <> '4')) (type: boolean)
                       Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                      Filter Operator
+                        predicate: _col0 is not null (type: boolean)
+                        Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_join2.q.out b/ql/src/test/results/clientpositive/ppd_join2.q.out
index b821d91..88624ea 100644
--- a/ql/src/test/results/clientpositive/ppd_join2.q.out
+++ b/ql/src/test/results/clientpositive/ppd_join2.q.out
@@ -46,17 +46,20 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 <> '302') and ((_col0 <> '311') and (_col0 < '400'))) (type: boolean)
-                  Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (_col0 <> '14') (type: boolean)
+                  Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: _col0 is not null (type: boolean)
-                    Statistics: Num rows: 14 Data size: 148 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    predicate: ((_col0 <> '302') and ((_col0 <> '311') and (_col0 < '400'))) (type: boolean)
+                    Statistics: Num rows: 27 Data size: 286 Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
                       Statistics: Num rows: 14 Data size: 148 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: string)
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 14 Data size: 148 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
@@ -68,17 +71,20 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 56 Data size: 594 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 <> '305') and (_col0 <> '14')) (type: boolean)
-                  Statistics: Num rows: 56 Data size: 594 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col0 <> '311') and (((_col1 <> 'val_50') or (_col0 > '1')) and (_col0 < '400'))) (type: boolean)
+                  Statistics: Num rows: 24 Data size: 254 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: _col0 is not null (type: boolean)
-                    Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
-                      Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: string)
+                    predicate: ((_col0 <> '305') and (_col0 <> '14')) (type: boolean)
+                    Statistics: Num rows: 24 Data size: 254 Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
+                      Statistics: Num rows: 12 Data size: 127 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 12 Data size: 127 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -87,21 +93,21 @@ STAGE PLANS:
             0 _col0 (type: string)
             1 _col0 (type: string)
           outputColumnNames: _col0, _col1, _col2, _col3
-          Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col2 (type: string), _col3 (type: string), _col0 (type: string), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: ((_col2 <> '10') or (_col0 <> '10')) (type: boolean)
-              Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
                 outputColumnNames: _col0, _col1, _col3
-                Statistics: Num rows: 30 Data size: 326 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 15 Data size: 162 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
                   predicate: _col1 is not null (type: boolean)
-                  Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 8 Data size: 86 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
                     table:
@@ -119,23 +125,30 @@ STAGE PLANS:
               predicate: (((key <> '306') and (sqrt(key) <> 13.0)) and value is not null) (type: boolean)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: value (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: _col0 is not null (type: boolean)
-                  Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (sqrt(_col0) <> 13.0) (type: boolean)
+                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col1 (type: string)
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
+                      Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 125 Data size: 1328 Basic stats: COMPLETE Column stats: NONE
           TableScan
             Reduce Output Operator
               key expressions: _col1 (type: string)
               sort order: +
               Map-reduce partition columns: _col1 (type: string)
-              Statistics: Num rows: 15 Data size: 163 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 8 Data size: 86 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: string), _col3 (type: string)
       Reduce Operator Tree:
         Join Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/e2f1caf3/ql/src/test/results/clientpositive/ppd_join3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_join3.q.out b/ql/src/test/results/clientpositive/ppd_join3.q.out
index 49da9e0..6c5c0da 100644
--- a/ql/src/test/results/clientpositive/ppd_join3.q.out
+++ b/ql/src/test/results/clientpositive/ppd_join3.q.out
@@ -46,17 +46,20 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 <> '11') and ((_col0 > '0') and (_col0 < '400'))) (type: boolean)
-                  Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (_col0 <> '4') (type: boolean)
+                  Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: _col0 is not null (type: boolean)
-                    Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    predicate: ((_col0 <> '11') and ((_col0 > '0') and (_col0 < '400'))) (type: boolean)
+                    Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
                       Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: string)
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
@@ -64,20 +67,27 @@ STAGE PLANS:
               predicate: (((((((((key <> '11') and (key > '0')) and ((value <> 'val_500') or (key > '1'))) and (key < '400')) and (key <> '12')) and (key <> '4')) and key is not null) and (key <> '13')) and (key <> '1')) (type: boolean)
               Statistics: Num rows: 37 Data size: 393 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 37 Data size: 393 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 <> '12') and (_col0 <> '4')) (type: boolean)
-                  Statistics: Num rows: 37 Data size: 393 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: _col0 is not null (type: boolean)
-                    Statistics: Num rows: 19 Data size: 201 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
-                      Statistics: Num rows: 19 Data size: 201 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col0 > '0') and (((_col1 <> 'val_500') or (_col0 > '1')) and (_col0 < '400'))) (type: boolean)
+                  Statistics: Num rows: 5 Data size: 53 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col0 (type: string)
+                    outputColumnNames: _col0
+                    Statistics: Num rows: 5 Data size: 53 Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: ((_col0 <> '12') and (_col0 <> '4')) (type: boolean)
+                      Statistics: Num rows: 5 Data size: 53 Basic stats: COMPLETE Column stats: NONE
+                      Filter Operator
+                        predicate: _col0 is not null (type: boolean)
+                        Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: string)
+                          Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -86,24 +96,24 @@ STAGE PLANS:
             0 _col0 (type: string)
             1 _col0 (type: string)
           outputColumnNames: _col0, _col1, _col2
-          Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col2 (type: string), _col0 (type: string), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2
-            Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: ((_col1 > '10') or (_col0 <> '10')) (type: boolean)
-              Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: _col0 (type: string), _col2 (type: string)
                 outputColumnNames: _col0, _col2
-                Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
                   predicate: ((_col0 <> '13') and (_col0 <> '1')) (type: boolean)
-                  Statistics: Num rows: 20 Data size: 221 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 3 Data size: 34 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: _col0 is not null (type: boolean)
-                    Statistics: Num rows: 10 Data size: 110 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
                       table:
@@ -125,22 +135,25 @@ STAGE PLANS:
                 outputColumnNames: _col0
                 Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col0 <> '11') and ((_col0 > '0') and ((_col0 < '400') and ((_col0 <> '12') and (_col0 <> '4'))))) (type: boolean)
-                  Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (_col0 <> '1') (type: boolean)
+                  Statistics: Num rows: 28 Data size: 297 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: _col0 is not null (type: boolean)
-                    Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: string)
+                    predicate: ((_col0 <> '11') and ((_col0 > '0') and ((_col0 < '400') and ((_col0 <> '12') and (_col0 <> '4'))))) (type: boolean)
+                    Statistics: Num rows: 3 Data size: 31 Basic stats: COMPLETE Column stats: NONE
+                    Filter Operator
+                      predicate: _col0 is not null (type: boolean)
                       Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
           TableScan
             Reduce Output Operator
               key expressions: _col0 (type: string)
               sort order: +
               Map-reduce partition columns: _col0 (type: string)
-              Statistics: Num rows: 10 Data size: 110 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col2 (type: string)
       Reduce Operator Tree:
         Join Operator
@@ -150,14 +163,14 @@ STAGE PLANS:
             0 _col0 (type: string)
             1 _col0 (type: string)
           outputColumnNames: _col1, _col3
-          Statistics: Num rows: 11 Data size: 121 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col1 (type: string), _col3 (type: string)
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 11 Data size: 121 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 11 Data size: 121 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.TextInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat