You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by px...@apache.org on 2017/02/11 20:43:00 UTC

hive git commit: HIVE-15388: HiveParser spends lots of time in parsing queries with lots of '(' (Pengcheng Xiong, reviewed by Ashutosh Chauhan, Gunther Hagleitner)

Repository: hive
Updated Branches:
  refs/heads/master 0959e7757 -> eb1da3087


HIVE-15388: HiveParser spends lots of time in parsing queries with lots of '(' (Pengcheng Xiong, reviewed by Ashutosh Chauhan, Gunther Hagleitner)


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

Branch: refs/heads/master
Commit: eb1da3087ae8c07fb31c148cd3a2e62fdb263644
Parents: 0959e77
Author: Pengcheng Xiong <px...@apache.org>
Authored: Sat Feb 11 12:41:50 2017 -0800
Committer: Pengcheng Xiong <px...@apache.org>
Committed: Sat Feb 11 12:42:27 2017 -0800

----------------------------------------------------------------------
 .../hadoop/hive/ql/parse/IdentifiersParser.g    | 162 +++++++++++-------
 .../hive/ql/parse/TestParseDriverIntervals.java |   2 +-
 .../hadoop/hive/ql/parse/TestQBSubQuery.java    |   2 +-
 ql/src/test/queries/clientnegative/udf_in_2.q   |   2 +
 .../test/queries/clientpositive/interval_alt.q  |  19 ++-
 ql/src/test/queries/clientpositive/parenthese.q |  80 +++++++++
 ql/src/test/queries/clientpositive/udf_in.q     |   4 +-
 ql/src/test/queries/clientpositive/udf_notop.q  |   2 +-
 .../clientnegative/char_pad_convert_fail2.q.out |   2 +-
 .../invalid_select_expression.q.out             |   2 +-
 .../ptf_negative_DistributeByOrderBy.q.out      |   2 +-
 .../ptf_negative_PartitionBySortBy.q.out        |   2 +-
 .../clientnegative/ptf_window_boundaries.q.out  |   2 +-
 .../clientnegative/ptf_window_boundaries2.q.out |   2 +-
 .../clientnegative/select_charliteral.q.out     |   3 +-
 .../clientnegative/subquery_missing_from.q.out  |   2 +-
 .../subquery_subquery_chain.q.out               |   2 +-
 .../clientnegative/subquery_with_or_cond.q.out  |   2 +-
 ql/src/test/results/clientnegative/udf_in.q.out |   2 +-
 .../test/results/clientnegative/udf_in_2.q.out  |   1 +
 .../results/clientpositive/interval_alt.q.out   |  73 ++++++--
 .../clientpositive/llap/vector_between_in.q.out |  22 +--
 .../results/clientpositive/parenthese.q.out     | 168 +++++++++++++++++++
 .../results/clientpositive/perf/query14.q.out   |   8 +-
 .../results/clientpositive/perf/query23.q.out   |   4 +-
 .../spark/vector_between_in.q.out               |  22 +--
 .../results/clientpositive/udf_between.q.out    |   2 +-
 ql/src/test/results/clientpositive/udf_in.q.out |   4 +-
 .../test/results/clientpositive/udf_notop.q.out |   4 +-
 29 files changed, 471 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index 1d8c3e0..81efadc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -76,14 +76,14 @@ rollupOldSyntax
 @init { gParent.pushMsg("rollup old syntax", state); }
 @after { gParent.popMsg(state); }
     :
-    expressionsNotInParenthese
+    expr=expressionsNotInParenthesis[false]
     ((rollup=KW_WITH KW_ROLLUP) | (cube=KW_WITH KW_CUBE)) ?
     (sets=KW_GROUPING KW_SETS
     LPAREN groupingSetExpression ( COMMA groupingSetExpression)*  RPAREN ) ?
-    -> {rollup != null}? ^(TOK_ROLLUP_GROUPBY expressionsNotInParenthese)
-    -> {cube != null}? ^(TOK_CUBE_GROUPBY expressionsNotInParenthese)
-    -> {sets != null}? ^(TOK_GROUPING_SETS expressionsNotInParenthese groupingSetExpression+)
-    -> ^(TOK_GROUPBY expressionsNotInParenthese)
+    -> {rollup != null}? ^(TOK_ROLLUP_GROUPBY {$expr.tree})
+    -> {cube != null}? ^(TOK_CUBE_GROUPBY {$expr.tree})
+    -> {sets != null}? ^(TOK_GROUPING_SETS {$expr.tree} groupingSetExpression+)
+    -> ^(TOK_GROUPBY {$expr.tree})
     ;
 
 
@@ -127,29 +127,39 @@ havingCondition
     expression
     ;
 
-expressionsInParenthese
+expressionsInParenthesis[boolean isStruct]
     :
-    LPAREN! expressionsNotInParenthese RPAREN!
+    LPAREN! expressionsNotInParenthesis[isStruct] RPAREN!
     ;
 
-expressionsNotInParenthese
+expressionsNotInParenthesis[boolean isStruct]
     :
-    expression (COMMA expression)* -> expression+
+    first=expression more=expressionPart[$expression.tree, isStruct]?
+    -> {more==null}?
+       {$first.tree}
+    -> {$more.tree}
+    ;
+
+expressionPart[CommonTree t, boolean isStruct]
+    :
+    (COMMA expression)+
+    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$t} expression+)
+    -> {$t} expression+
     ;
 
 expressions
     :
-    (expressionsInParenthese) => expressionsInParenthese
+    (expressionsInParenthesis[false]) => expressionsInParenthesis[false]
     |
-    expressionsNotInParenthese
+    expressionsNotInParenthesis[false]
     ;
 
-columnRefOrderInParenthese
+columnRefOrderInParenthesis
     :
     LPAREN columnRefOrder (COMMA columnRefOrder)* RPAREN -> columnRefOrder+
     ;
 
-columnRefOrderNotInParenthese
+columnRefOrderNotInParenthesis
     :
     columnRefOrder (COMMA columnRefOrder)* -> columnRefOrder+
     ;
@@ -189,9 +199,9 @@ sortByClause
     :
     KW_SORT KW_BY
     (
-    (LPAREN) => columnRefOrderInParenthese -> ^(TOK_SORTBY columnRefOrderInParenthese)
+    (LPAREN) => columnRefOrderInParenthesis -> ^(TOK_SORTBY columnRefOrderInParenthesis)
     |
-    columnRefOrderNotInParenthese -> ^(TOK_SORTBY columnRefOrderNotInParenthese)
+    columnRefOrderNotInParenthesis -> ^(TOK_SORTBY columnRefOrderNotInParenthesis)
     )
     ;
 
@@ -303,7 +313,9 @@ timeQualifiers
 constant
 @init { gParent.pushMsg("constant", state); }
 @after { gParent.popMsg(state); }
-    : Number
+    : 
+    (intervalLiteral) => intervalLiteral
+    | Number
     | dateLiteral
     | timestampLiteral
     | StringLiteral
@@ -349,13 +361,27 @@ timestampLiteral
     KW_CURRENT_TIMESTAMP -> ^(TOK_FUNCTION KW_CURRENT_TIMESTAMP)
     ;
 
+intervalValue
+    :
+    StringLiteral | Number
+    ;
+
+intervalLiteral
+    :
+    value=intervalValue qualifiers=intervalQualifiers
+    -> ^(TOK_FUNCTION Identifier["internal_interval"] NumberLiteral[Integer.toString(((CommonTree)qualifiers.getTree()).token.getType())] $value)
+    ;
+
 intervalExpression
     :
-    KW_INTERVAL? k1=(StringLiteral|Number) q1=intervalQualifiers ->
-		^(TOK_FUNCTION Identifier["internal_interval"] NumberLiteral[Integer.toString(((CommonTree)q1.getTree()).token.getType())] $k1)
+    LPAREN value=intervalValue RPAREN qualifiers=intervalQualifiers
+    -> ^(TOK_FUNCTION Identifier["internal_interval"] NumberLiteral[Integer.toString(((CommonTree)qualifiers.getTree()).token.getType())] $value)
+    |
+    KW_INTERVAL value=intervalValue qualifiers=intervalQualifiers
+    -> ^(TOK_FUNCTION Identifier["internal_interval"] NumberLiteral[Integer.toString(((CommonTree)qualifiers.getTree()).token.getType())] $value)
     |
-    KW_INTERVAL? LPAREN k2=expression RPAREN q2=intervalQualifiers ->
-		^(TOK_FUNCTION Identifier["internal_interval"] NumberLiteral[Integer.toString(((CommonTree)q2.getTree()).token.getType())] $k2)
+    KW_INTERVAL LPAREN expr=expression RPAREN qualifiers=intervalQualifiers
+    -> ^(TOK_FUNCTION Identifier["internal_interval"] NumberLiteral[Integer.toString(((CommonTree)qualifiers.getTree()).token.getType())] $expr)
     ;
 
 intervalQualifiers
@@ -379,8 +405,8 @@ expression
 
 atomExpression
     :
-    (intervalExpression)=>intervalExpression
-    | (constant) => constant
+    constant
+    | (intervalExpression) => intervalExpression
     | castExpression
     | extractExpression
     | floorExpression
@@ -390,7 +416,7 @@ atomExpression
         -> ^(TOK_SUBQUERY_EXPR TOK_SUBQUERY_OP subQueryExpression)
     | (function) => function
     | tableOrColumn
-    | LPAREN! expression RPAREN!
+    | expressionsInParenthesis[true]
     ;
 
 precedenceFieldExpression
@@ -490,69 +516,79 @@ precedenceBitwiseOrExpression
     ;
 
 
-// Equal operators supporting NOT prefix
-precedenceEqualNegatableOperator
+precedenceRegexpOperator
     :
     KW_LIKE | KW_RLIKE | KW_REGEXP
     ;
 
-precedenceEqualOperator
+precedenceSimilarOperator
     :
-    precedenceEqualNegatableOperator | EQUAL | EQUAL_NS | NOTEQUAL | LESSTHANOREQUALTO | LESSTHAN | GREATERTHANOREQUALTO | GREATERTHAN
+    precedenceRegexpOperator | LESSTHANOREQUALTO | LESSTHAN | GREATERTHANOREQUALTO | GREATERTHAN
     ;
 
-subQueryExpression 
-    : 
+subQueryExpression
+    :
     LPAREN! selectStatement RPAREN!
     ;
 
-precedenceEqualExpression
+precedenceSimilarExpression
     :
-    (precedenceEqualExpressionSingle) => precedenceEqualExpressionSingle
+    precedenceSimilarExpressionMain
     |
-    precedenceEqualExpressionMutiple
+    KW_EXISTS subQueryExpression -> ^(TOK_SUBQUERY_EXPR ^(TOK_SUBQUERY_OP KW_EXISTS) subQueryExpression)    
     ;
- 
-precedenceEqualExpressionSingle
+
+precedenceSimilarExpressionMain
     :
-    (left=precedenceBitwiseOrExpression -> $left)
-    (
-      (KW_NOT precedenceEqualNegatableOperator notExpr=precedenceBitwiseOrExpression)
-       -> ^(KW_NOT ^(precedenceEqualNegatableOperator $precedenceEqualExpressionSingle $notExpr))
-    | (precedenceEqualOperator equalExpr=precedenceBitwiseOrExpression)
-       -> ^(precedenceEqualOperator $precedenceEqualExpressionSingle $equalExpr)
-    | (KW_NOT KW_IN LPAREN KW_SELECT)=>  (KW_NOT KW_IN subQueryExpression)
-       -> ^(KW_NOT ^(TOK_SUBQUERY_EXPR ^(TOK_SUBQUERY_OP KW_IN) subQueryExpression $precedenceEqualExpressionSingle))
-    | (KW_NOT KW_IN expressionsInParenthese)
-       -> ^(KW_NOT ^(TOK_FUNCTION KW_IN $precedenceEqualExpressionSingle expressionsInParenthese))
-    | (KW_IN LPAREN KW_SELECT)=>  (KW_IN subQueryExpression)
-       -> ^(TOK_SUBQUERY_EXPR ^(TOK_SUBQUERY_OP KW_IN) subQueryExpression $precedenceEqualExpressionSingle)
-    | (KW_IN expressionsInParenthese)
-       -> ^(TOK_FUNCTION KW_IN $precedenceEqualExpressionSingle expressionsInParenthese)
-    | ( KW_NOT KW_BETWEEN (min=precedenceBitwiseOrExpression) KW_AND (max=precedenceBitwiseOrExpression) )
-       -> ^(TOK_FUNCTION Identifier["between"] KW_TRUE $precedenceEqualExpressionSingle $min $max)
-    | ( KW_BETWEEN (min=precedenceBitwiseOrExpression) KW_AND (max=precedenceBitwiseOrExpression) )
-       -> ^(TOK_FUNCTION Identifier["between"] KW_FALSE $precedenceEqualExpressionSingle $min $max)
-    )*
-    | KW_EXISTS subQueryExpression -> ^(TOK_SUBQUERY_EXPR ^(TOK_SUBQUERY_OP KW_EXISTS) subQueryExpression)    
+    a=precedenceBitwiseOrExpression part=precedenceSimilarExpressionPart[$precedenceBitwiseOrExpression.tree]?
+    -> {part == null}? {$a.tree}
+    -> {$part.tree}
+    ;
+    
+precedenceSimilarExpressionPart[CommonTree t]
+    :
+    (precedenceSimilarOperator equalExpr=precedenceBitwiseOrExpression)
+    -> ^(precedenceSimilarOperator {$t} $equalExpr)
+    |
+    precedenceSimilarExpressionAtom[$t]
+    |
+    (KW_NOT^ precedenceSimilarExpressionPartNot[$t])
     ;
 
+precedenceSimilarExpressionAtom[CommonTree t]
+    :
+    KW_IN! precedenceSimilarExpressionIn[$t]
+    |
+    KW_BETWEEN (min=precedenceBitwiseOrExpression) KW_AND (max=precedenceBitwiseOrExpression)
+    -> ^(TOK_FUNCTION Identifier["between"] KW_FALSE {$t} $min $max)
+    ;
 
-//we transform the (col0, col1) in ((v00,v01),(v10,v11)) into struct(col0, col1) in (struct(v00,v01),struct(v10,v11))
-precedenceEqualExpressionMutiple
+precedenceSimilarExpressionIn[CommonTree t]
     :
-    (LPAREN precedenceBitwiseOrExpression (COMMA precedenceBitwiseOrExpression)+ RPAREN -> ^(TOK_FUNCTION Identifier["struct"] precedenceBitwiseOrExpression+))
-    ( (KW_IN LPAREN expressionsToStruct (COMMA expressionsToStruct)* RPAREN)
-       -> ^(TOK_FUNCTION KW_IN $precedenceEqualExpressionMutiple expressionsToStruct*)
-    | (KW_NOT KW_IN LPAREN expressionsToStruct (COMMA expressionsToStruct)* RPAREN)
-       -> ^(KW_NOT ^(TOK_FUNCTION KW_IN $precedenceEqualExpressionMutiple expressionsToStruct*)))
+    (subQueryExpression) => subQueryExpression -> ^(TOK_SUBQUERY_EXPR ^(TOK_SUBQUERY_OP KW_IN) subQueryExpression {$t})
+    |
+    expr=expressionsInParenthesis[false]
+    -> ^(TOK_FUNCTION Identifier["in"] {$t} {$expr.tree})
     ;
 
-expressionsToStruct
+precedenceSimilarExpressionPartNot[CommonTree t]
     :
-    LPAREN expression (COMMA expression)* RPAREN -> ^(TOK_FUNCTION Identifier["struct"] expression+)
+    precedenceRegexpOperator notExpr=precedenceBitwiseOrExpression
+    -> ^(precedenceRegexpOperator {$t} $notExpr)
+    |
+    precedenceSimilarExpressionAtom[$t]
     ;
 
+precedenceEqualOperator
+    :
+    EQUAL | EQUAL_NS | NOTEQUAL
+    ;
+
+precedenceEqualExpression
+    :
+    precedenceSimilarExpression (precedenceEqualOperator^ precedenceSimilarExpression)*
+    ;
+    
 precedenceNotOperator
     :
     KW_NOT

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/org/apache/hadoop/hive/ql/parse/TestParseDriverIntervals.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestParseDriverIntervals.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestParseDriverIntervals.java
index e5db412..98ad12a 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestParseDriverIntervals.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestParseDriverIntervals.java
@@ -40,7 +40,7 @@ public class TestParseDriverIntervals {
     ret.add(new Object[] { "select 1 days" });
     ret.add(new Object[] { "select (1) days" });
     ret.add(new Object[] { "select (1) day" });
-    ret.add(new Object[] { "select (1+1) days" });
+    ret.add(new Object[] { "select interval (1+1) days" });
     ret.add(new Object[] { "select interval 1 days" });
     ret.add(new Object[] { "select interval '1' days" });
     ret.add(new Object[] { "select interval (x) days" });

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/org/apache/hadoop/hive/ql/parse/TestQBSubQuery.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestQBSubQuery.java b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestQBSubQuery.java
index 311a34d..2674835 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/parse/TestQBSubQuery.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/parse/TestQBSubQuery.java
@@ -72,7 +72,7 @@ public class TestQBSubQuery {
     Assert.assertEquals(1,sqs.size());
 
     ASTNode sq = sqs.get(0);
-    Assert.assertEquals("(tok_subquery_expr (tok_subquery_op in) (tok_query (tok_from (tok_tabref (tok_tabname src) s1)) (tok_insert (tok_destination (tok_dir tok_tmp_file)) (tok_select (tok_selexpr (tok_table_or_col key))) (tok_where (and (> (. (tok_table_or_col s1) key) '9') (> (. (tok_table_or_col s1) value) '9'))))) (. (tok_table_or_col src) key))"
+    Assert.assertEquals("(tok_subquery_expr (tok_subquery_op kw_in) (tok_query (tok_from (tok_tabref (tok_tabname src) s1)) (tok_insert (tok_destination (tok_dir tok_tmp_file)) (tok_select (tok_selexpr (tok_table_or_col key))) (tok_where (and (> (. (tok_table_or_col s1) key) '9') (> (. (tok_table_or_col s1) value) '9'))))) (. (tok_table_or_col src) key))"
         ,sq.toStringTree());
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/queries/clientnegative/udf_in_2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/udf_in_2.q b/ql/src/test/queries/clientnegative/udf_in_2.q
new file mode 100644
index 0000000..2288054
--- /dev/null
+++ b/ql/src/test/queries/clientnegative/udf_in_2.q
@@ -0,0 +1,2 @@
+select 1=1 in (true, false);
+

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/queries/clientpositive/interval_alt.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/interval_alt.q b/ql/src/test/queries/clientpositive/interval_alt.q
index a4fbe9f..824e5d3 100644
--- a/ql/src/test/queries/clientpositive/interval_alt.q
+++ b/ql/src/test/queries/clientpositive/interval_alt.q
@@ -1,3 +1,8 @@
+select 1+1 in (1,2,3,4);
+select (1+1) in (1,2,3,4);
+select true=false in (true,false);
+select false=false in (true,false);
+select interval '5-5' year to month;
 
 select
 	(1) second,
@@ -22,15 +27,15 @@ insert into t values (1),(2);
 -- expressions/columnref
 explain
 select
-	date '2012-01-01' +          (-dt*dt) day,
+	date '2012-01-01' + interval (-dt*dt) day,
 	date '2012-01-01' - interval (-dt*dt) day,
 	date '2012-01-01' + 1 day + '2' days,
-	date '2012-01-01' + (dt || '-1') year to month
+	date '2012-01-01' + interval (dt || '-1') year to month
 	from t;
 
 select
-	date '2012-01-01' +          (-dt*dt) day,
-	date '2012-01-01' - interval (-dt*dt) day,
-	date '2012-01-01' + 1 day + '2' days,
-	date '2012-01-01' + (dt || '-1') year to month
-	from t;
+        date '2012-01-01' + interval (-dt*dt) day,
+        date '2012-01-01' - interval (-dt*dt) day,
+        date '2012-01-01' + 1 day + '2' days,
+        date '2012-01-01' + interval (dt || '-1') year to month
+        from t;

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/queries/clientpositive/parenthese.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/parenthese.q b/ql/src/test/queries/clientpositive/parenthese.q
new file mode 100644
index 0000000..60a2b5b
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/parenthese.q
@@ -0,0 +1,80 @@
+drop table airports;
+create table airports (airport string);
+
+SELECT * FROM airports
+WHERE (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((`airports`.`airport` = "Thigpen"
+                                                                                OR `airports`.`airport` = "Astoria Regional")
+                                                                               OR `airports`.`airport` = "Warsaw Municipal")
+                                                                              OR `airports`.`airport` = "John F Kennedy Memorial")
+                                                                             OR `airports`.`airport` = "Hall-Miller Municipal")
+                                                                            OR `airports`.`airport` = "Atqasuk")
+                                                                           OR `airports`.`airport` = "William B Hartsfield-Atlanta Intl")
+                                                                          OR `airports`.`airport` = "Artesia Municipal")
+                                                                         OR `airports`.`airport` = "Outagamie County Regional")
+                                                                        OR `airports`.`airport` = "Watertown Municipal")
+                                                                       OR `airports`.`airport` = "Augusta State")
+                                                                      OR `airports`.`airport` = "Aurora Municipal")
+                                                                     OR `airports`.`airport` = "Alakanuk")
+                                                                    OR `airports`.`airport` = "Austin Municipal")
+                                                                   OR `airports`.`airport` = "Auburn Municipal")
+                                                                  OR `airports`.`airport` = "Auburn-Opelik")
+                                                                 OR `airports`.`airport` = "Austin-Bergstrom International")
+                                                                OR `airports`.`airport` = "Wausau Municipal")
+                                                               OR `airports`.`airport` = "Mecklenburg-Brunswick Regional")
+                                                              OR `airports`.`airport` = "Alva Regional")
+                                                             OR `airports`.`airport` = "Asheville Regional")
+                                                            OR `airports`.`airport` = "Avon Park Municipal")
+                                                           OR `airports`.`airport` = "Wilkes-Barre/Scranton Intl")
+                                                          OR `airports`.`airport` = "Marana Northwest Regional")
+                                                         OR `airports`.`airport` = "Catalina")
+                                                        OR `airports`.`airport` = "Washington Municipal")
+                                                       OR `airports`.`airport` = "Wainwright")
+                                                      OR `airports`.`airport` = "West Memphis Municipal")
+                                                     OR `airports`.`airport` = "Arlington Municipal")
+                                                    OR `airports`.`airport` = "Algona Municipal")
+                                                   OR `airports`.`airport` = "Chandler")
+                                                  OR `airports`.`airport` = "Altus Municipal")
+                                                 OR `airports`.`airport` = "Neil Armstrong")
+                                                OR `airports`.`airport` = "Angel Fire")
+                                               OR `airports`.`airport` = "Waycross-Ware County")
+                                              OR `airports`.`airport` = "Colorado City Municipal")
+                                             OR `airports`.`airport` = "Hazelhurst")
+                                            OR `airports`.`airport` = "Kalamazoo County")
+                                           OR `airports`.`airport` = "Granville")
+                                          OR `airports`.`airport` = "Silver Springs")
+                                         OR `airports`.`airport` = "Whitford")
+                                        OR `airports`.`airport` = "Biddeford Municipal")
+                                       OR `airports`.`airport` = "Sugarloaf Regional")
+                                      OR `airports`.`airport` = "Barnes Municipal")
+                                     OR `airports`.`airport` = "Columbus Municipal")
+                                    OR `airports`.`airport` = "Battle Mountain")
+                                   OR `airports`.`airport` = "Huron County Memorial")
+                                  OR `airports`.`airport` = "New Braunfels Municipal")
+                                 OR `airports`.`airport` = "Benson Municipal")
+                                OR `airports`.`airport` = "Curtis")
+                               OR `airports`.`airport` = "Marlboro County")
+                              OR `airports`.`airport` = "Broken Bow Municipal")
+                             OR `airports`.`airport` = "Virginia Tech")
+                            OR `airports`.`airport` = "Bryce Canyon")
+                           OR `airports`.`airport` = "Black River Falls Area")
+                          OR `airports`.`airport` = "Boca Raton")
+                         OR `airports`.`airport` = "Birchwood")
+                        OR `airports`.`airport` = "Baudette International")
+                       OR `airports`.`airport` = "Blanding Muni")
+                      OR `airports`.`airport` = "Bradley International")
+                     OR `airports`.`airport` = "Morrilton Municipal")
+                    OR `airports`.`airport` = "Igor I Sikorsky Memorial")
+                   OR `airports`.`airport` = "Broadus")
+                  OR `airports`.`airport` = "Laurence G Hanscom")
+                 OR `airports`.`airport` = "Southwest Michigan Regional")
+                OR `airports`.`airport` = "Bethel")
+               OR `airports`.`airport` = "Bradford Reg")
+              OR `airports`.`airport` = "Scotts Bluff County")
+             OR `airports`.`airport` = "Boeing Field/King County Intl")
+            OR `airports`.`airport` = "Buffalo Municipal")
+           OR `airports`.`airport` = "Meadows")
+          OR `airports`.`airport` = "Mobile Downtown")
+         OR `airports`.`airport` = "Virgil I Grissom Municipal")
+        OR `airports`.`airport` = "Silver Bay Municipal");
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/queries/clientpositive/udf_in.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_in.q b/ql/src/test/queries/clientpositive/udf_in.q
index a7ce3c6..f54d963 100644
--- a/ql/src/test/queries/clientpositive/udf_in.q
+++ b/ql/src/test/queries/clientpositive/udf_in.q
@@ -5,11 +5,11 @@ SELECT 1 IN (1, 2, 3),
        array(1,2,3) IN (array(1,2,3)),
        "bee" IN("aee", "bee", "cee", 1),
        "dee" IN("aee", "bee", "cee"),
-       1 = 1 IN(true, false),
+       (1 = 1) IN(true, false),
        true IN (true, false) = true,
        1 IN (1, 2, 3) OR false IN(false),
        NULL IN (1, 2, 3),
        4 IN (1, 2, 3, NULL),
        (1+3) IN (5, 6, (1+2) + 1) FROM src tablesample (1 rows);
 
-SELECT key FROM src WHERE key IN ("238", 86);
\ No newline at end of file
+SELECT key FROM src WHERE key IN ("238", 86);

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/queries/clientpositive/udf_notop.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_notop.q b/ql/src/test/queries/clientpositive/udf_notop.q
index dceab7e..5cf918c 100644
--- a/ql/src/test/queries/clientpositive/udf_notop.q
+++ b/ql/src/test/queries/clientpositive/udf_notop.q
@@ -2,7 +2,7 @@ set hive.fetch.task.conversion=more;
 
 SELECT 1 NOT IN (1, 2, 3),
        4 NOT IN (1, 2, 3),
-       1 = 2 NOT IN (true, false),
+       (1 = 2) NOT IN (true, false),
        "abc" NOT LIKE "a%",
        "abc" NOT LIKE "b%",
        "abc" NOT RLIKE "^ab",

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/char_pad_convert_fail2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/char_pad_convert_fail2.q.out b/ql/src/test/results/clientnegative/char_pad_convert_fail2.q.out
index 2d08fb3..2780b7c 100644
--- a/ql/src/test/results/clientnegative/char_pad_convert_fail2.q.out
+++ b/ql/src/test/results/clientnegative/char_pad_convert_fail2.q.out
@@ -40,4 +40,4 @@ POSTHOOK: query: load data local inpath '../../data/files/over1k' into table ove
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@over1k
-FAILED: ParseException line 7:7 cannot recognize input near 'lpad' '(' '{' in expression specification
+FAILED: ParseException line 7:11 cannot recognize input near 'lpad' '(' '{' in expression specification

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/invalid_select_expression.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/invalid_select_expression.q.out b/ql/src/test/results/clientnegative/invalid_select_expression.q.out
index 3650ca7..63a682a 100644
--- a/ql/src/test/results/clientnegative/invalid_select_expression.q.out
+++ b/ql/src/test/results/clientnegative/invalid_select_expression.q.out
@@ -1 +1 @@
-FAILED: ParseException line 1:26 cannot recognize input near 'foo' '>' '.' in expression specification
+FAILED: ParseException line 1:32 cannot recognize input near '.' 'foo' '<EOF>' in expression specification

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/ptf_negative_DistributeByOrderBy.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/ptf_negative_DistributeByOrderBy.q.out b/ql/src/test/results/clientnegative/ptf_negative_DistributeByOrderBy.q.out
index a0f3fe2..e8e8580 100644
--- a/ql/src/test/results/clientnegative/ptf_negative_DistributeByOrderBy.q.out
+++ b/ql/src/test/results/clientnegative/ptf_negative_DistributeByOrderBy.q.out
@@ -1 +1 @@
-FAILED: ParseException line 3:0 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification
+FAILED: ParseException line 3:3 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/ptf_negative_PartitionBySortBy.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/ptf_negative_PartitionBySortBy.q.out b/ql/src/test/results/clientnegative/ptf_negative_PartitionBySortBy.q.out
index a0f3fe2..e8e8580 100644
--- a/ql/src/test/results/clientnegative/ptf_negative_PartitionBySortBy.q.out
+++ b/ql/src/test/results/clientnegative/ptf_negative_PartitionBySortBy.q.out
@@ -1 +1 @@
-FAILED: ParseException line 3:0 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification
+FAILED: ParseException line 3:3 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/ptf_window_boundaries.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/ptf_window_boundaries.q.out b/ql/src/test/results/clientnegative/ptf_window_boundaries.q.out
index 3808f2c..c9c1c6d 100644
--- a/ql/src/test/results/clientnegative/ptf_window_boundaries.q.out
+++ b/ql/src/test/results/clientnegative/ptf_window_boundaries.q.out
@@ -1 +1 @@
-FAILED: ParseException line 2:4 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification
+FAILED: ParseException line 2:7 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/ptf_window_boundaries2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/ptf_window_boundaries2.q.out b/ql/src/test/results/clientnegative/ptf_window_boundaries2.q.out
index 3808f2c..c9c1c6d 100644
--- a/ql/src/test/results/clientnegative/ptf_window_boundaries2.q.out
+++ b/ql/src/test/results/clientnegative/ptf_window_boundaries2.q.out
@@ -1 +1 @@
-FAILED: ParseException line 2:4 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification
+FAILED: ParseException line 2:7 cannot recognize input near 'sum' '(' 'p_retailprice' in expression specification

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/select_charliteral.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/select_charliteral.q.out b/ql/src/test/results/clientnegative/select_charliteral.q.out
index 1d02fa1..09e409b 100644
--- a/ql/src/test/results/clientnegative/select_charliteral.q.out
+++ b/ql/src/test/results/clientnegative/select_charliteral.q.out
@@ -1 +1,2 @@
-FAILED: ParseException line 3:7 cannot recognize input near '_c17' ',' 'count' in expression specification
+FAILED: ParseException line 3:11 missing \' at ',' near '_c17' in character string literal
+line 4:0 mismatched input '<EOF>' expecting \' near '_c17' in character string literal

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/subquery_missing_from.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/subquery_missing_from.q.out b/ql/src/test/results/clientnegative/subquery_missing_from.q.out
index eaf7735..b09a8e3 100644
--- a/ql/src/test/results/clientnegative/subquery_missing_from.q.out
+++ b/ql/src/test/results/clientnegative/subquery_missing_from.q.out
@@ -1,3 +1,3 @@
 FAILED: SemanticException Line 0:-1 Invalid SubQuery expression 'key' in definition of SubQuery sq_1 [
 src.key in (select key)
-] used as sq_1 at Line 1:32: From clause is missing in SubQuery.
+] used as sq_1 at Line 0:-1: From clause is missing in SubQuery.

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/subquery_subquery_chain.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/subquery_subquery_chain.q.out b/ql/src/test/results/clientnegative/subquery_subquery_chain.q.out
index e661e1b..e08b86c 100644
--- a/ql/src/test/results/clientnegative/subquery_subquery_chain.q.out
+++ b/ql/src/test/results/clientnegative/subquery_subquery_chain.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10249]: org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSubquerySemanticException: Line 5:14 Unsupported SubQuery Expression 'key': IN/NOT IN subqueries are not allowed in LHS
+FAILED: ParseException line 5:39 missing EOF at 'in' near ')'

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/subquery_with_or_cond.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/subquery_with_or_cond.q.out b/ql/src/test/results/clientnegative/subquery_with_or_cond.q.out
index 4a9cc45..9e41a41 100644
--- a/ql/src/test/results/clientnegative/subquery_with_or_cond.q.out
+++ b/ql/src/test/results/clientnegative/subquery_with_or_cond.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10249]: org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSubquerySemanticException: Line 4:14 Unsupported SubQuery Expression 'key': Only SubQuery expressions that are top level conjuncts are allowed
+FAILED: SemanticException org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSubquerySemanticException: Line 0:-1 Unsupported SubQuery Expression 'key': Only SubQuery expressions that are top level conjuncts are allowed

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/udf_in.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_in.q.out b/ql/src/test/results/clientnegative/udf_in.q.out
index 773230b..c032ee4 100644
--- a/ql/src/test/results/clientnegative/udf_in.q.out
+++ b/ql/src/test/results/clientnegative/udf_in.q.out
@@ -1 +1 @@
-FAILED: SemanticException [Error 10014]: Line 1:9 Wrong arguments '3': The arguments for IN should be the same type! Types are: {int IN (array<int>)}
+FAILED: SemanticException Line 0:-1 Wrong arguments '3': The arguments for IN should be the same type! Types are: {int IN (array<int>)}

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientnegative/udf_in_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/udf_in_2.q.out b/ql/src/test/results/clientnegative/udf_in_2.q.out
new file mode 100644
index 0000000..83883e3
--- /dev/null
+++ b/ql/src/test/results/clientnegative/udf_in_2.q.out
@@ -0,0 +1 @@
+FAILED: SemanticException Line 0:-1 Wrong arguments 'false': The arguments for IN should be the same type! Types are: {int IN (boolean, boolean)}

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/interval_alt.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/interval_alt.q.out b/ql/src/test/results/clientpositive/interval_alt.q.out
index 04d5874..9884ec3 100644
--- a/ql/src/test/results/clientpositive/interval_alt.q.out
+++ b/ql/src/test/results/clientpositive/interval_alt.q.out
@@ -1,3 +1,48 @@
+PREHOOK: query: select 1+1 in (1,2,3,4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: select 1+1 in (1,2,3,4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+true
+PREHOOK: query: select (1+1) in (1,2,3,4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: select (1+1) in (1,2,3,4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+true
+PREHOOK: query: select true=false in (true,false)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: select true=false in (true,false)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+true
+PREHOOK: query: select false=false in (true,false)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: select false=false in (true,false)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+false
+PREHOOK: query: select interval '5-5' year to month
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+POSTHOOK: query: select interval '5-5' year to month
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+#### A masked pattern was here ####
+5-5
 PREHOOK: query: select
 	(1) second,
 	 2  seconds,
@@ -66,18 +111,18 @@ POSTHOOK: Output: default@t
 POSTHOOK: Lineage: t.dt EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
 PREHOOK: query: explain
 select
-	date '2012-01-01' +          (-dt*dt) day,
+	date '2012-01-01' + interval (-dt*dt) day,
 	date '2012-01-01' - interval (-dt*dt) day,
 	date '2012-01-01' + 1 day + '2' days,
-	date '2012-01-01' + (dt || '-1') year to month
+	date '2012-01-01' + interval (dt || '-1') year to month
 	from t
 PREHOOK: type: QUERY
 POSTHOOK: query: explain
 select
-	date '2012-01-01' +          (-dt*dt) day,
+	date '2012-01-01' + interval (-dt*dt) day,
 	date '2012-01-01' - interval (-dt*dt) day,
 	date '2012-01-01' + 1 day + '2' days,
-	date '2012-01-01' + (dt || '-1') year to month
+	date '2012-01-01' + interval (dt || '-1') year to month
 	from t
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
@@ -110,20 +155,20 @@ STAGE PLANS:
         ListSink
 
 PREHOOK: query: select
-	date '2012-01-01' +          (-dt*dt) day,
-	date '2012-01-01' - interval (-dt*dt) day,
-	date '2012-01-01' + 1 day + '2' days,
-	date '2012-01-01' + (dt || '-1') year to month
-	from t
+        date '2012-01-01' + interval (-dt*dt) day,
+        date '2012-01-01' - interval (-dt*dt) day,
+        date '2012-01-01' + 1 day + '2' days,
+        date '2012-01-01' + interval (dt || '-1') year to month
+        from t
 PREHOOK: type: QUERY
 PREHOOK: Input: default@t
 #### A masked pattern was here ####
 POSTHOOK: query: select
-	date '2012-01-01' +          (-dt*dt) day,
-	date '2012-01-01' - interval (-dt*dt) day,
-	date '2012-01-01' + 1 day + '2' days,
-	date '2012-01-01' + (dt || '-1') year to month
-	from t
+        date '2012-01-01' + interval (-dt*dt) day,
+        date '2012-01-01' - interval (-dt*dt) day,
+        date '2012-01-01' + 1 day + '2' days,
+        date '2012-01-01' + interval (dt || '-1') year to month
+        from t
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@t
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/llap/vector_between_in.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_between_in.q.out b/ql/src/test/results/clientpositive/llap/vector_between_in.q.out
index 8a4383e..4bbb170 100644
--- a/ql/src/test/results/clientpositive/llap/vector_between_in.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_between_in.q.out
@@ -553,8 +553,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterLongColumnNotBetween(col 3, left -610, right 608) -> boolean
-                    predicate: cdate NOT BETWEEN 1968-05-01 AND 1971-09-01 (type: boolean)
+                        predicateExpression: SelectColumnIsFalse(col 4)(children: VectorUDFAdaptor(cdate BETWEEN 1968-05-01 AND 1971-09-01) -> 4:boolean) -> boolean
+                    predicate: (not cdate BETWEEN 1968-05-01 AND 1971-09-01) (type: boolean)
                     Statistics: Num rows: 10923 Data size: 2193503 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: cdate (type: date)
@@ -581,7 +581,7 @@ STAGE PLANS:
                 groupByVectorOutput: true
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized, llap
@@ -747,8 +747,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterDecimalColumnNotBetween(col 1, left -2000, right 4390.1351351351) -> boolean
-                    predicate: cdecimal1 NOT BETWEEN -2000 AND 4390.1351351351 (type: boolean)
+                        predicateExpression: SelectColumnIsFalse(col 4)(children: VectorUDFAdaptor(cdecimal1 BETWEEN -2000 AND 4390.1351351351) -> 4:boolean) -> boolean
+                    predicate: (not cdecimal1 BETWEEN -2000 AND 4390.1351351351) (type: boolean)
                     Statistics: Num rows: 10923 Data size: 2193503 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       Select Vectorization:
@@ -784,7 +784,7 @@ STAGE PLANS:
                 groupByVectorOutput: true
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized, llap
@@ -1516,21 +1516,21 @@ STAGE PLANS:
                       native: true
                       projectedOutputColumns: [0, 1, 2, 3]
                   Select Operator
-                    expressions: cdecimal1 NOT BETWEEN -2000 AND 4390.1351351351 (type: boolean)
+                    expressions: (not cdecimal1 BETWEEN -2000 AND 4390.1351351351) (type: boolean)
                     outputColumnNames: _col0
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumns: [4]
-                        selectExpressions: VectorUDFAdaptor(cdecimal1 NOT BETWEEN -2000 AND 4390.1351351351) -> 4:boolean
+                        projectedOutputColumns: [5]
+                        selectExpressions: NotCol(col 4)(children: VectorUDFAdaptor(cdecimal1 BETWEEN -2000 AND 4390.1351351351) -> 4:boolean) -> 5:boolean
                     Statistics: Num rows: 12288 Data size: 2467616 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: count(1)
                       Group By Vectorization:
-                          aggregators: VectorUDAFCount(ConstantVectorExpression(val 1) -> 5:long) -> bigint
+                          aggregators: VectorUDAFCount(ConstantVectorExpression(val 1) -> 4:long) -> bigint
                           className: VectorGroupByOperator
                           vectorOutput: true
-                          keyExpressions: col 4
+                          keyExpressions: col 5
                           native: false
                           projectedOutputColumns: [0]
                       keys: _col0 (type: boolean)

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/parenthese.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/parenthese.q.out b/ql/src/test/results/clientpositive/parenthese.q.out
new file mode 100644
index 0000000..e7eae5a
--- /dev/null
+++ b/ql/src/test/results/clientpositive/parenthese.q.out
@@ -0,0 +1,168 @@
+PREHOOK: query: drop table airports
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table airports
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table airports (airport string)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@airports
+POSTHOOK: query: create table airports (airport string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@airports
+PREHOOK: query: SELECT * FROM airports
+WHERE (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((`airports`.`airport` = "Thigpen"
+                                                                                OR `airports`.`airport` = "Astoria Regional")
+                                                                               OR `airports`.`airport` = "Warsaw Municipal")
+                                                                              OR `airports`.`airport` = "John F Kennedy Memorial")
+                                                                             OR `airports`.`airport` = "Hall-Miller Municipal")
+                                                                            OR `airports`.`airport` = "Atqasuk")
+                                                                           OR `airports`.`airport` = "William B Hartsfield-Atlanta Intl")
+                                                                          OR `airports`.`airport` = "Artesia Municipal")
+                                                                         OR `airports`.`airport` = "Outagamie County Regional")
+                                                                        OR `airports`.`airport` = "Watertown Municipal")
+                                                                       OR `airports`.`airport` = "Augusta State")
+                                                                      OR `airports`.`airport` = "Aurora Municipal")
+                                                                     OR `airports`.`airport` = "Alakanuk")
+                                                                    OR `airports`.`airport` = "Austin Municipal")
+                                                                   OR `airports`.`airport` = "Auburn Municipal")
+                                                                  OR `airports`.`airport` = "Auburn-Opelik")
+                                                                 OR `airports`.`airport` = "Austin-Bergstrom International")
+                                                                OR `airports`.`airport` = "Wausau Municipal")
+                                                               OR `airports`.`airport` = "Mecklenburg-Brunswick Regional")
+                                                              OR `airports`.`airport` = "Alva Regional")
+                                                             OR `airports`.`airport` = "Asheville Regional")
+                                                            OR `airports`.`airport` = "Avon Park Municipal")
+                                                           OR `airports`.`airport` = "Wilkes-Barre/Scranton Intl")
+                                                          OR `airports`.`airport` = "Marana Northwest Regional")
+                                                         OR `airports`.`airport` = "Catalina")
+                                                        OR `airports`.`airport` = "Washington Municipal")
+                                                       OR `airports`.`airport` = "Wainwright")
+                                                      OR `airports`.`airport` = "West Memphis Municipal")
+                                                     OR `airports`.`airport` = "Arlington Municipal")
+                                                    OR `airports`.`airport` = "Algona Municipal")
+                                                   OR `airports`.`airport` = "Chandler")
+                                                  OR `airports`.`airport` = "Altus Municipal")
+                                                 OR `airports`.`airport` = "Neil Armstrong")
+                                                OR `airports`.`airport` = "Angel Fire")
+                                               OR `airports`.`airport` = "Waycross-Ware County")
+                                              OR `airports`.`airport` = "Colorado City Municipal")
+                                             OR `airports`.`airport` = "Hazelhurst")
+                                            OR `airports`.`airport` = "Kalamazoo County")
+                                           OR `airports`.`airport` = "Granville")
+                                          OR `airports`.`airport` = "Silver Springs")
+                                         OR `airports`.`airport` = "Whitford")
+                                        OR `airports`.`airport` = "Biddeford Municipal")
+                                       OR `airports`.`airport` = "Sugarloaf Regional")
+                                      OR `airports`.`airport` = "Barnes Municipal")
+                                     OR `airports`.`airport` = "Columbus Municipal")
+                                    OR `airports`.`airport` = "Battle Mountain")
+                                   OR `airports`.`airport` = "Huron County Memorial")
+                                  OR `airports`.`airport` = "New Braunfels Municipal")
+                                 OR `airports`.`airport` = "Benson Municipal")
+                                OR `airports`.`airport` = "Curtis")
+                               OR `airports`.`airport` = "Marlboro County")
+                              OR `airports`.`airport` = "Broken Bow Municipal")
+                             OR `airports`.`airport` = "Virginia Tech")
+                            OR `airports`.`airport` = "Bryce Canyon")
+                           OR `airports`.`airport` = "Black River Falls Area")
+                          OR `airports`.`airport` = "Boca Raton")
+                         OR `airports`.`airport` = "Birchwood")
+                        OR `airports`.`airport` = "Baudette International")
+                       OR `airports`.`airport` = "Blanding Muni")
+                      OR `airports`.`airport` = "Bradley International")
+                     OR `airports`.`airport` = "Morrilton Municipal")
+                    OR `airports`.`airport` = "Igor I Sikorsky Memorial")
+                   OR `airports`.`airport` = "Broadus")
+                  OR `airports`.`airport` = "Laurence G Hanscom")
+                 OR `airports`.`airport` = "Southwest Michigan Regional")
+                OR `airports`.`airport` = "Bethel")
+               OR `airports`.`airport` = "Bradford Reg")
+              OR `airports`.`airport` = "Scotts Bluff County")
+             OR `airports`.`airport` = "Boeing Field/King County Intl")
+            OR `airports`.`airport` = "Buffalo Municipal")
+           OR `airports`.`airport` = "Meadows")
+          OR `airports`.`airport` = "Mobile Downtown")
+         OR `airports`.`airport` = "Virgil I Grissom Municipal")
+        OR `airports`.`airport` = "Silver Bay Municipal")
+PREHOOK: type: QUERY
+PREHOOK: Input: default@airports
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM airports
+WHERE (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((`airports`.`airport` = "Thigpen"
+                                                                                OR `airports`.`airport` = "Astoria Regional")
+                                                                               OR `airports`.`airport` = "Warsaw Municipal")
+                                                                              OR `airports`.`airport` = "John F Kennedy Memorial")
+                                                                             OR `airports`.`airport` = "Hall-Miller Municipal")
+                                                                            OR `airports`.`airport` = "Atqasuk")
+                                                                           OR `airports`.`airport` = "William B Hartsfield-Atlanta Intl")
+                                                                          OR `airports`.`airport` = "Artesia Municipal")
+                                                                         OR `airports`.`airport` = "Outagamie County Regional")
+                                                                        OR `airports`.`airport` = "Watertown Municipal")
+                                                                       OR `airports`.`airport` = "Augusta State")
+                                                                      OR `airports`.`airport` = "Aurora Municipal")
+                                                                     OR `airports`.`airport` = "Alakanuk")
+                                                                    OR `airports`.`airport` = "Austin Municipal")
+                                                                   OR `airports`.`airport` = "Auburn Municipal")
+                                                                  OR `airports`.`airport` = "Auburn-Opelik")
+                                                                 OR `airports`.`airport` = "Austin-Bergstrom International")
+                                                                OR `airports`.`airport` = "Wausau Municipal")
+                                                               OR `airports`.`airport` = "Mecklenburg-Brunswick Regional")
+                                                              OR `airports`.`airport` = "Alva Regional")
+                                                             OR `airports`.`airport` = "Asheville Regional")
+                                                            OR `airports`.`airport` = "Avon Park Municipal")
+                                                           OR `airports`.`airport` = "Wilkes-Barre/Scranton Intl")
+                                                          OR `airports`.`airport` = "Marana Northwest Regional")
+                                                         OR `airports`.`airport` = "Catalina")
+                                                        OR `airports`.`airport` = "Washington Municipal")
+                                                       OR `airports`.`airport` = "Wainwright")
+                                                      OR `airports`.`airport` = "West Memphis Municipal")
+                                                     OR `airports`.`airport` = "Arlington Municipal")
+                                                    OR `airports`.`airport` = "Algona Municipal")
+                                                   OR `airports`.`airport` = "Chandler")
+                                                  OR `airports`.`airport` = "Altus Municipal")
+                                                 OR `airports`.`airport` = "Neil Armstrong")
+                                                OR `airports`.`airport` = "Angel Fire")
+                                               OR `airports`.`airport` = "Waycross-Ware County")
+                                              OR `airports`.`airport` = "Colorado City Municipal")
+                                             OR `airports`.`airport` = "Hazelhurst")
+                                            OR `airports`.`airport` = "Kalamazoo County")
+                                           OR `airports`.`airport` = "Granville")
+                                          OR `airports`.`airport` = "Silver Springs")
+                                         OR `airports`.`airport` = "Whitford")
+                                        OR `airports`.`airport` = "Biddeford Municipal")
+                                       OR `airports`.`airport` = "Sugarloaf Regional")
+                                      OR `airports`.`airport` = "Barnes Municipal")
+                                     OR `airports`.`airport` = "Columbus Municipal")
+                                    OR `airports`.`airport` = "Battle Mountain")
+                                   OR `airports`.`airport` = "Huron County Memorial")
+                                  OR `airports`.`airport` = "New Braunfels Municipal")
+                                 OR `airports`.`airport` = "Benson Municipal")
+                                OR `airports`.`airport` = "Curtis")
+                               OR `airports`.`airport` = "Marlboro County")
+                              OR `airports`.`airport` = "Broken Bow Municipal")
+                             OR `airports`.`airport` = "Virginia Tech")
+                            OR `airports`.`airport` = "Bryce Canyon")
+                           OR `airports`.`airport` = "Black River Falls Area")
+                          OR `airports`.`airport` = "Boca Raton")
+                         OR `airports`.`airport` = "Birchwood")
+                        OR `airports`.`airport` = "Baudette International")
+                       OR `airports`.`airport` = "Blanding Muni")
+                      OR `airports`.`airport` = "Bradley International")
+                     OR `airports`.`airport` = "Morrilton Municipal")
+                    OR `airports`.`airport` = "Igor I Sikorsky Memorial")
+                   OR `airports`.`airport` = "Broadus")
+                  OR `airports`.`airport` = "Laurence G Hanscom")
+                 OR `airports`.`airport` = "Southwest Michigan Regional")
+                OR `airports`.`airport` = "Bethel")
+               OR `airports`.`airport` = "Bradford Reg")
+              OR `airports`.`airport` = "Scotts Bluff County")
+             OR `airports`.`airport` = "Boeing Field/King County Intl")
+            OR `airports`.`airport` = "Buffalo Municipal")
+           OR `airports`.`airport` = "Meadows")
+          OR `airports`.`airport` = "Mobile Downtown")
+         OR `airports`.`airport` = "Virgil I Grissom Municipal")
+        OR `airports`.`airport` = "Silver Bay Municipal")
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@airports
+#### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/perf/query14.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query14.q.out b/ql/src/test/results/clientpositive/perf/query14.q.out
index 21cabbc..55a2e5b 100644
--- a/ql/src/test/results/clientpositive/perf/query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/query14.q.out
@@ -1,9 +1,9 @@
-Warning: Shuffle Join MERGEJOIN[916][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 114' is a cross product
-Warning: Shuffle Join MERGEJOIN[917][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 115' is a cross product
-Warning: Shuffle Join MERGEJOIN[912][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 5' is a cross product
-Warning: Shuffle Join MERGEJOIN[913][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 6' is a cross product
 Warning: Shuffle Join MERGEJOIN[914][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 61' is a cross product
 Warning: Shuffle Join MERGEJOIN[915][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 62' is a cross product
+Warning: Shuffle Join MERGEJOIN[912][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 5' is a cross product
+Warning: Shuffle Join MERGEJOIN[913][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 6' is a cross product
+Warning: Shuffle Join MERGEJOIN[916][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 114' is a cross product
+Warning: Shuffle Join MERGEJOIN[917][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 115' is a cross product
 PREHOOK: query: explain
 with  cross_items as
  (select i_item_sk ss_item_sk

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/perf/query23.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query23.q.out b/ql/src/test/results/clientpositive/perf/query23.q.out
index 59f2586..85cee23 100644
--- a/ql/src/test/results/clientpositive/perf/query23.q.out
+++ b/ql/src/test/results/clientpositive/perf/query23.q.out
@@ -1,7 +1,7 @@
-Warning: Shuffle Join MERGEJOIN[382][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 51' is a cross product
-Warning: Shuffle Join MERGEJOIN[383][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 52' is a cross product
 Warning: Shuffle Join MERGEJOIN[379][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 19' is a cross product
 Warning: Shuffle Join MERGEJOIN[380][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 20' is a cross product
+Warning: Shuffle Join MERGEJOIN[382][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 51' is a cross product
+Warning: Shuffle Join MERGEJOIN[383][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 52' is a cross product
 PREHOOK: query: explain with frequent_ss_items as 
  (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
   from store_sales

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/spark/vector_between_in.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vector_between_in.q.out b/ql/src/test/results/clientpositive/spark/vector_between_in.q.out
index 4de2eb6..82d96ea 100644
--- a/ql/src/test/results/clientpositive/spark/vector_between_in.q.out
+++ b/ql/src/test/results/clientpositive/spark/vector_between_in.q.out
@@ -542,8 +542,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterLongColumnNotBetween(col 3, left -610, right 608) -> boolean
-                    predicate: cdate NOT BETWEEN 1968-05-01 AND 1971-09-01 (type: boolean)
+                        predicateExpression: SelectColumnIsFalse(col 4)(children: VectorUDFAdaptor(cdate BETWEEN 1968-05-01 AND 1971-09-01) -> 4:boolean) -> boolean
+                    predicate: (not cdate BETWEEN 1968-05-01 AND 1971-09-01) (type: boolean)
                     Statistics: Num rows: 10923 Data size: 2193503 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: cdate (type: date)
@@ -569,7 +569,7 @@ STAGE PLANS:
                 groupByVectorOutput: true
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized
@@ -732,8 +732,8 @@ STAGE PLANS:
                     Filter Vectorization:
                         className: VectorFilterOperator
                         native: true
-                        predicateExpression: FilterDecimalColumnNotBetween(col 1, left -2000, right 4390.1351351351) -> boolean
-                    predicate: cdecimal1 NOT BETWEEN -2000 AND 4390.1351351351 (type: boolean)
+                        predicateExpression: SelectColumnIsFalse(col 4)(children: VectorUDFAdaptor(cdecimal1 BETWEEN -2000 AND 4390.1351351351) -> 4:boolean) -> boolean
+                    predicate: (not cdecimal1 BETWEEN -2000 AND 4390.1351351351) (type: boolean)
                     Statistics: Num rows: 10923 Data size: 2193503 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       Select Vectorization:
@@ -768,7 +768,7 @@ STAGE PLANS:
                 groupByVectorOutput: true
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                 allNative: false
-                usesVectorUDFAdaptor: false
+                usesVectorUDFAdaptor: true
                 vectorized: true
         Reducer 2 
             Execution mode: vectorized
@@ -1496,21 +1496,21 @@ STAGE PLANS:
                       native: true
                       projectedOutputColumns: [0, 1, 2, 3]
                   Select Operator
-                    expressions: cdecimal1 NOT BETWEEN -2000 AND 4390.1351351351 (type: boolean)
+                    expressions: (not cdecimal1 BETWEEN -2000 AND 4390.1351351351) (type: boolean)
                     outputColumnNames: _col0
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumns: [4]
-                        selectExpressions: VectorUDFAdaptor(cdecimal1 NOT BETWEEN -2000 AND 4390.1351351351) -> 4:boolean
+                        projectedOutputColumns: [5]
+                        selectExpressions: NotCol(col 4)(children: VectorUDFAdaptor(cdecimal1 BETWEEN -2000 AND 4390.1351351351) -> 4:boolean) -> 5:boolean
                     Statistics: Num rows: 12288 Data size: 2467616 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: count(1)
                       Group By Vectorization:
-                          aggregators: VectorUDAFCount(ConstantVectorExpression(val 1) -> 5:long) -> bigint
+                          aggregators: VectorUDAFCount(ConstantVectorExpression(val 1) -> 4:long) -> bigint
                           className: VectorGroupByOperator
                           vectorOutput: true
-                          keyExpressions: col 4
+                          keyExpressions: col 5
                           native: false
                           projectedOutputColumns: [0]
                       keys: _col0 (type: boolean)

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/udf_between.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_between.q.out b/ql/src/test/results/clientpositive/udf_between.q.out
index 5b01554..2bb7264 100644
--- a/ql/src/test/results/clientpositive/udf_between.q.out
+++ b/ql/src/test/results/clientpositive/udf_between.q.out
@@ -81,7 +81,7 @@ STAGE PLANS:
           alias: src
           Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (UDFToDouble(key) + 100.0) NOT BETWEEN 100 AND 200 (type: boolean)
+            predicate: (not (UDFToDouble(key) + 100.0) BETWEEN 100 AND 200) (type: boolean)
             Statistics: Num rows: 445 Data size: 4727 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: key (type: string), value (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/udf_in.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_in.q.out b/ql/src/test/results/clientpositive/udf_in.q.out
index da07f61..85ee951 100644
--- a/ql/src/test/results/clientpositive/udf_in.q.out
+++ b/ql/src/test/results/clientpositive/udf_in.q.out
@@ -3,7 +3,7 @@ PREHOOK: query: SELECT 1 IN (1, 2, 3),
        array(1,2,3) IN (array(1,2,3)),
        "bee" IN("aee", "bee", "cee", 1),
        "dee" IN("aee", "bee", "cee"),
-       1 = 1 IN(true, false),
+       (1 = 1) IN(true, false),
        true IN (true, false) = true,
        1 IN (1, 2, 3) OR false IN(false),
        NULL IN (1, 2, 3),
@@ -17,7 +17,7 @@ POSTHOOK: query: SELECT 1 IN (1, 2, 3),
        array(1,2,3) IN (array(1,2,3)),
        "bee" IN("aee", "bee", "cee", 1),
        "dee" IN("aee", "bee", "cee"),
-       1 = 1 IN(true, false),
+       (1 = 1) IN(true, false),
        true IN (true, false) = true,
        1 IN (1, 2, 3) OR false IN(false),
        NULL IN (1, 2, 3),

http://git-wip-us.apache.org/repos/asf/hive/blob/eb1da308/ql/src/test/results/clientpositive/udf_notop.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/udf_notop.q.out b/ql/src/test/results/clientpositive/udf_notop.q.out
index 25483c7..e8b57e5 100644
--- a/ql/src/test/results/clientpositive/udf_notop.q.out
+++ b/ql/src/test/results/clientpositive/udf_notop.q.out
@@ -1,6 +1,6 @@
 PREHOOK: query: SELECT 1 NOT IN (1, 2, 3),
        4 NOT IN (1, 2, 3),
-       1 = 2 NOT IN (true, false),
+       (1 = 2) NOT IN (true, false),
        "abc" NOT LIKE "a%",
        "abc" NOT LIKE "b%",
        "abc" NOT RLIKE "^ab",
@@ -13,7 +13,7 @@ PREHOOK: Input: default@src
 #### A masked pattern was here ####
 POSTHOOK: query: SELECT 1 NOT IN (1, 2, 3),
        4 NOT IN (1, 2, 3),
-       1 = 2 NOT IN (true, false),
+       (1 = 2) NOT IN (true, false),
        "abc" NOT LIKE "a%",
        "abc" NOT LIKE "b%",
        "abc" NOT RLIKE "^ab",