asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Support LIKE, NOT LIKE, IN, NOT IN.
Date Tue, 05 Jul 2016 06:50:54 GMT
Yingyi Bu has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/974

Change subject: Support LIKE, NOT LIKE, IN, NOT IN.
......................................................................

Support LIKE, NOT LIKE, IN, NOT IN.

Change-Id: I497c4420431460bc461937dd5fc58956e1fad6ea
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_01/like_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_null/like_null.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_01/like_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_null/like_null.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/OperatorType.java
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/OperatorExpressionVisitor.java
M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
39 files changed, 304 insertions(+), 158 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/74/974/1

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 13eb399..03b530b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -930,7 +930,6 @@
                     }
                 } else {
                     AbstractFunctionCallExpression f = createFunctionCallExpressionForBuiltinOperator(ops.get(i));
-
                     if (i == 0) {
                         f.getArguments().add(new MutableObject<>(e));
                         currExpr = f;
@@ -1182,53 +1181,40 @@
 
     protected AbstractFunctionCallExpression createFunctionCallExpressionForBuiltinOperator(OperatorType t)
             throws AsterixException {
-
-        FunctionIdentifier fid = null;
+        FunctionIdentifier fid;
         switch (t) {
-            case PLUS: {
+            case PLUS:
                 fid = AlgebricksBuiltinFunctions.NUMERIC_ADD;
                 break;
-            }
-            case MINUS: {
+            case MINUS:
                 fid = AsterixBuiltinFunctions.NUMERIC_SUBTRACT;
                 break;
-            }
-            case MUL: {
+            case MUL:
                 fid = AsterixBuiltinFunctions.NUMERIC_MULTIPLY;
                 break;
-            }
-            case DIV: {
+            case DIV:
                 fid = AsterixBuiltinFunctions.NUMERIC_DIVIDE;
                 break;
-            }
-            case MOD: {
+            case MOD:
                 fid = AsterixBuiltinFunctions.NUMERIC_MOD;
                 break;
-            }
-            case IDIV: {
+            case IDIV:
                 fid = AsterixBuiltinFunctions.NUMERIC_IDIV;
                 break;
-            }
-            case CARET: {
+            case CARET:
                 fid = AsterixBuiltinFunctions.CARET;
                 break;
-            }
-            case AND: {
+            case AND:
                 fid = AlgebricksBuiltinFunctions.AND;
                 break;
-            }
-            case OR: {
+            case OR:
                 fid = AlgebricksBuiltinFunctions.OR;
                 break;
-            }
-            case FUZZY_EQ: {
+            case FUZZY_EQ:
                 fid = AsterixBuiltinFunctions.FUZZY_EQ;
                 break;
-            }
-
-            default: {
+            default:
                 throw new NotImplementedException("Operator " + t + " is not yet implemented");
-            }
         }
         return new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(fid));
     }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_01/like_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_01/like_01.3.query.sqlpp
index c5ebc10..fa4a4e0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_01/like_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_01/like_01.3.query.sqlpp
@@ -20,4 +20,4 @@
 use test;
 
 
-select element [test.like('A6BBB','_6%'),test.like('A8BBB','_6%')];
+select element ['A6BBB' LIKE '_6%', 'A8BBB' LIKE '_6%' ];
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_null/like_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_null/like_null.3.query.sqlpp
index caa1618..3251659 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_null/like_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/like_null/like_null.3.query.sqlpp
@@ -20,4 +20,4 @@
 use test;
 
 
-{'field1':test.like('A8BBB',null),'field2':test.like(null,'_6%')};
+{'field1': 'A8BBB' LIKE null,'field2': null LIKE '_6%'};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index 499899d..cbb55c4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -40,7 +40,7 @@
         ) as srn
         where (srn.s_suppkey = ps.ps_suppkey)
     ) as pssrn
-    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    where p.p_partkey = pssrn.p_partkey and p.p_type like '%BRASS'
 )
 };
 declare function tmp2() {
@@ -66,7 +66,7 @@
         ) as srn
         where (srn.s_suppkey = ps.ps_suppkey)
     ) as pssrn
-    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    where p.p_partkey = pssrn.p_partkey and p.p_type like '%BRASS'
     /* +hash */
     group by pssrn.p_partkey as p_partkey
 )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index 45888f3..24f4f46 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -32,7 +32,7 @@
         select element {'c_custkey':c.c_custkey,'o_orderkey_count':coll_count((
                 select element o.o_orderkey
                 from  Orders as o
-                where c.c_custkey = o.o_custkey and NOT like(o.o_comment,'%special%requests%')
+                where c.c_custkey = o.o_custkey and o.o_comment not like '%special%requests%'
             ))}
         from  Customer as c
     ) as co
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 6c4e330..eb556b16 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@
 
 
 select element (100.0 * tpch.coll_sum((
-      select element tpch.`switch-case`(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      select element tpch.`switch-case`(i.p_type like 'PROMO%',true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
       from  lp as i
   )) / tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index a6a53bb..131c8a0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -27,10 +27,10 @@
         select element {'p_brand':p.p_brand,'p_type':p.p_type,'p_size':p.p_size,'ps_suppkey':ps.ps_suppkey}
         from  Partsupp as ps,
               Part as p
-        where p.p_partkey = ps.ps_partkey and p.p_brand != 'Brand#45' and not like(p.p_type,'MEDIUM POLISHED%')
+        where p.p_partkey = ps.ps_partkey and p.p_brand != 'Brand#45' and p.p_type not like 'MEDIUM POLISHED%'
     ) as psp,
           Supplier as s
-    where psp.ps_suppkey = s.s_suppkey and not like(s.s_comment,'%Customer%Complaints%')
+    where psp.ps_suppkey = s.s_suppkey and s.s_comment not like '%Customer%Complaints%'
 )
 };
 select element {'p_brand':p_brand,'p_type':p_type,'p_size':p_size,'supplier_cnt':supplier_cnt}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index b13a11a..e1704fe 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -26,7 +26,7 @@
  FROM Nation JOIN Region ON n_regionkey = r_regionkey and r_name = 'EUROPE'
  JOIN Supplier ON s_nationkey = n_nationkey
  JOIN Partsupp ON s_suppkey = ps_suppkey
- JOIN Part ON p_partkey = ps_partkey AND like(p_type, '%BRASS')
+ JOIN Part ON p_partkey = ps_partkey AND p_type LIKE '%BRASS'
 ),
 q2_minimum_cost_supplier_tmp2 AS
 (
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index 31d4dbc..bd5f431 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -28,7 +28,7 @@
                            (
                             select element o_orderkey
                             from  Orders
-                            where c_custkey = o_custkey and not(like(o_comment,'%special%requests%'))
+                            where c_custkey = o_custkey and o_comment NOT LIKE '%special%requests%'
                            )
                          ) AS o_orderkey_count
                 from  Customer
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 56d7637..1c10baf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@
 
 
 select element 100.0 *
-     sum(`switch-case`(like(p_type,'PROMO%'),true,(l_extendedprice * (1 - l_discount)),false,0.0))
+     sum(`switch-case`(p_type LIKE 'PROMO%',true, l_extendedprice * (1 - l_discount), false, 0.0))
      / sum(l_extendedprice * (1 - l_discount))
 FROM  LineItem,
       Part
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index 2b56eab..5d9eef3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -28,10 +28,10 @@
             FROM  Partsupp,
                   Part
             WHERE p_partkey = ps_partkey AND p_brand != 'Brand#45' AND
-              not(like(p_type,'MEDIUM POLISHED%'))
+                  p_type NOT LIKE 'MEDIUM POLISHED%'
            ) AS psp,
            Supplier
-    WHERE ps_suppkey = s_suppkey AND not(like(s_comment,'%Customer%Complaints%'))
+    WHERE ps_suppkey = s_suppkey AND s_comment NOT LIKE '%Customer%Complaints%'
 )
 
 SELECT p_brand, p_type, p_size, count(ps_suppkey) supplier_cnt
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index 636fb04..8f84f62 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -39,7 +39,7 @@
   JOIN Partsupp ps
   ON s.s_suppkey = ps.ps_suppkey
   JOIN Part p
-  ON p.p_partkey = ps.ps_partkey AND like(p.p_type, '%BRASS')
+  ON p.p_partkey = ps.ps_partkey AND p.p_type LIKE '%BRASS'
 ),
 q2_minimum_cost_supplier_tmp2 AS
 (SELECT
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index 3124fdc..fb3e8e7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -28,7 +28,7 @@
                            (
                             select element o.o_orderkey
                             from  Orders as o
-                            where c.c_custkey = o.o_custkey and NOT like(o.o_comment,'%special%requests%')
+                            where c.c_custkey = o.o_custkey and o.o_comment NOT LIKE '%special%requests%'
                            )
                          ) AS o_orderkey_count
                 from  Customer c
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 57dde0d..dc26e42 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@
 
 
 select element 100.0 *
-     sum(`switch-case`(like(p.p_type,'PROMO%'),true,(l.l_extendedprice * (1 - l.l_discount)),false,0.0))
+     sum(`switch-case`(p.p_type like 'PROMO%',true,(l.l_extendedprice * (1 - l.l_discount)),false,0.0))
      / sum(l.l_extendedprice * (1 - l.l_discount))
 FROM  LineItem l,
       Part p
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index c96b23b..18a4d43 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -27,10 +27,10 @@
             SELECT p.p_brand p_brand, p.p_type p_type, p.p_size p_size, ps.ps_suppkey ps_suppkey
             FROM  Partsupp AS ps,
                   Part AS p
-            WHERE p.p_partkey = ps.ps_partkey AND p.p_brand != 'Brand#45' AND NOT like(p.p_type,'MEDIUM POLISHED%')
+            WHERE p.p_partkey = ps.ps_partkey AND p.p_brand != 'Brand#45' AND p.p_type not like 'MEDIUM POLISHED%'
            ) AS psp,
            Supplier AS s
-    WHERE psp.ps_suppkey = s.s_suppkey AND NOT like(s.s_comment,'%Customer%Complaints%')
+    WHERE psp.ps_suppkey = s.s_suppkey AND s.s_comment not like '%Customer%Complaints%'
 )
 };
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index 499899d..cbb55c4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -40,7 +40,7 @@
         ) as srn
         where (srn.s_suppkey = ps.ps_suppkey)
     ) as pssrn
-    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    where p.p_partkey = pssrn.p_partkey and p.p_type like '%BRASS'
 )
 };
 declare function tmp2() {
@@ -66,7 +66,7 @@
         ) as srn
         where (srn.s_suppkey = ps.ps_suppkey)
     ) as pssrn
-    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    where p.p_partkey = pssrn.p_partkey and p.p_type like '%BRASS'
     /* +hash */
     group by pssrn.p_partkey as p_partkey
 )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index 45888f3..24f4f46 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -32,7 +32,7 @@
         select element {'c_custkey':c.c_custkey,'o_orderkey_count':coll_count((
                 select element o.o_orderkey
                 from  Orders as o
-                where c.c_custkey = o.o_custkey and NOT like(o.o_comment,'%special%requests%')
+                where c.c_custkey = o.o_custkey and o.o_comment not like '%special%requests%'
             ))}
         from  Customer as c
     ) as co
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 6c4e330..eb556b16 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@
 
 
 select element (100.0 * tpch.coll_sum((
-      select element tpch.`switch-case`(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      select element tpch.`switch-case`(i.p_type like 'PROMO%',true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
       from  lp as i
   )) / tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index a6a53bb..131c8a0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -27,10 +27,10 @@
         select element {'p_brand':p.p_brand,'p_type':p.p_type,'p_size':p.p_size,'ps_suppkey':ps.ps_suppkey}
         from  Partsupp as ps,
               Part as p
-        where p.p_partkey = ps.ps_partkey and p.p_brand != 'Brand#45' and not like(p.p_type,'MEDIUM POLISHED%')
+        where p.p_partkey = ps.ps_partkey and p.p_brand != 'Brand#45' and p.p_type not like 'MEDIUM POLISHED%'
     ) as psp,
           Supplier as s
-    where psp.ps_suppkey = s.s_suppkey and not like(s.s_comment,'%Customer%Complaints%')
+    where psp.ps_suppkey = s.s_suppkey and s.s_comment not like '%Customer%Complaints%'
 )
 };
 select element {'p_brand':p_brand,'p_type':p_type,'p_size':p_size,'supplier_cnt':supplier_cnt}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
index edae05b..f6ad005 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.query.sqlpp
@@ -40,7 +40,7 @@
         ) as srn
         where (srn.s_suppkey = ps.ps_suppkey)
     ) as pssrn
-    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    where p.p_partkey = pssrn.p_partkey and p.p_type like '%BRASS'
 )
 };
 declare function tmp2() {
@@ -66,7 +66,7 @@
         ) as srn
         where (srn.s_suppkey = ps.ps_suppkey)
     ) as pssrn
-    where ((p.p_partkey = pssrn.p_partkey) and tpch.like(p.p_type,'%BRASS'))
+    where p.p_partkey = pssrn.p_partkey and p.p_type like '%BRASS'
     /* +hash */
     group by pssrn.p_partkey as p_partkey
 )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
index c5ae516..e68fcc4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.query.sqlpp
@@ -32,7 +32,7 @@
         select element {'c_custkey':c.c_custkey,'o_orderkey_count':coll_count((
                 select element o.o_orderkey
                 from  Orders as o
-                where c.c_custkey = o.o_custkey and NOT like(o.o_comment,'%special%requests%')
+                where c.c_custkey = o.o_custkey and o.o_comment not like '%special%requests%'
             ))}
         from  Customer as c
     ) as co
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index bcb5d55..ba7de7d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@
 
 
 select element (100.0 * COLL_SUM((
-      select element tpch.`switch-case`(LIKE(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      select element tpch.`switch-case`(i.p_type like 'PROMO%',true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
       from  lp as i
   )) / COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
index 481d4d1..0cdbcfd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.query.sqlpp
@@ -27,10 +27,10 @@
         select element {'p_brand':p.p_brand,'p_type':p.p_type,'p_size':p.p_size,'ps_suppkey':ps.ps_suppkey}
         from  Partsupp as ps,
               Part as p
-        where p.p_partkey = ps.ps_partkey and p.p_brand != 'Brand#45' and not like(p.p_type,'MEDIUM POLISHED%')
+        where p.p_partkey = ps.ps_partkey and p.p_brand != 'Brand#45' and p.p_type not like 'MEDIUM POLISHED%'
     ) as psp,
           Supplier as s
-    where psp.ps_suppkey = s.s_suppkey and NOT LIKE(s.s_comment,'%Customer%Complaints%')
+    where psp.ps_suppkey = s.s_suppkey and s.s_comment not like '%Customer%Complaints%'
 )
 };
 select element {'p_brand':p_brand,'p_type':p_type,'p_size':p_size,'supplier_cnt':supplier_cnt}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_01/like_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_01/like_01.3.ast
index ca602eb..ee361dd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_01/like_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_01/like_01.3.ast
@@ -2,12 +2,14 @@
 Query:
 SELECT ELEMENT [
 OrderedListConstructor [
-  FunctionCall test.like@2[
+  OperatorExpr [
     LiteralExpr [STRING] [A6BBB]
+    like
     LiteralExpr [STRING] [_6%]
   ]
-  FunctionCall test.like@2[
+  OperatorExpr [
     LiteralExpr [STRING] [A8BBB]
+    like
     LiteralExpr [STRING] [_6%]
   ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_null/like_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_null/like_null.3.ast
index 6cf5fca..a829f6b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_null/like_null.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/like_null/like_null.3.ast
@@ -4,16 +4,18 @@
   (
     LiteralExpr [STRING] [field1]
     :
-    FunctionCall test.like@2[
+    OperatorExpr [
       LiteralExpr [STRING] [A8BBB]
+      like
       LiteralExpr [NULL]
     ]
   )
   (
     LiteralExpr [STRING] [field2]
     :
-    FunctionCall test.like@2[
+    OperatorExpr [
       LiteralExpr [NULL]
+      like
       LiteralExpr [STRING] [_6%]
     ]
   )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
index 0fa04eb..72ac671 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
@@ -313,11 +313,12 @@
           ]
         ]
         and
-        FunctionCall tpch.like@2[
+        OperatorExpr [
           FieldAccessor [
             Variable [ Name=$p ]
             Field=p_type
           ]
+          like
           LiteralExpr [STRING] [%BRASS]
         ]
       ]
@@ -588,11 +589,12 @@
           ]
         ]
         and
-        FunctionCall tpch.like@2[
+        OperatorExpr [
           FieldAccessor [
             Variable [ Name=$p ]
             Field=p_type
           ]
+          like
           LiteralExpr [STRING] [%BRASS]
         ]
       ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
index 38af625..4ab59b1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q13_customer_distribution/q13_customer_distribution.3.ast
@@ -83,14 +83,13 @@
                       ]
                     ]
                     and
-                    FunctionCall null.not@1[
-                      FunctionCall tpch.like@2[
-                        FieldAccessor [
-                          Variable [ Name=$o ]
-                          Field=o_comment
-                        ]
-                        LiteralExpr [STRING] [%special%requests%]
+                    OperatorExpr [
+                      FieldAccessor [
+                        Variable [ Name=$o ]
+                        Field=o_comment
                       ]
+                      not_like
+                      LiteralExpr [STRING] [%special%requests%]
                     ]
                   ]
               )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
index 1f8c630..f9f5c62 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.ast
@@ -8,11 +8,12 @@
     (
       SELECT ELEMENT [
       FunctionCall tpch.switch-case@5[
-        FunctionCall tpch.like@2[
+        OperatorExpr [
           FieldAccessor [
             Variable [ Name=$i ]
             Field=p_type
           ]
+          like
           LiteralExpr [STRING] [PROMO%]
         ]
         LiteralExpr [TRUE]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
index e00c9c7..aef4422 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch-sql-like/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
@@ -103,14 +103,13 @@
               LiteralExpr [STRING] [Brand#45]
             ]
             and
-            FunctionCall null.not@1[
-              FunctionCall tpch.like@2[
-                FieldAccessor [
-                  Variable [ Name=$p ]
-                  Field=p_type
-                ]
-                LiteralExpr [STRING] [MEDIUM POLISHED%]
+            OperatorExpr [
+              FieldAccessor [
+                Variable [ Name=$p ]
+                Field=p_type
               ]
+              not_like
+              LiteralExpr [STRING] [MEDIUM POLISHED%]
             ]
           ]
       )
@@ -133,14 +132,13 @@
           ]
         ]
         and
-        FunctionCall null.not@1[
-          FunctionCall tpch.like@2[
-            FieldAccessor [
-              Variable [ Name=$s ]
-              Field=s_comment
-            ]
-            LiteralExpr [STRING] [%Customer%Complaints%]
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=$s ]
+            Field=s_comment
           ]
+          not_like
+          LiteralExpr [STRING] [%Customer%Complaints%]
         ]
       ]
   )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
index 0fa04eb..72ac671 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q02_minimum_cost_supplier/q02_minimum_cost_supplier.3.ast
@@ -313,11 +313,12 @@
           ]
         ]
         and
-        FunctionCall tpch.like@2[
+        OperatorExpr [
           FieldAccessor [
             Variable [ Name=$p ]
             Field=p_type
           ]
+          like
           LiteralExpr [STRING] [%BRASS]
         ]
       ]
@@ -588,11 +589,12 @@
           ]
         ]
         and
-        FunctionCall tpch.like@2[
+        OperatorExpr [
           FieldAccessor [
             Variable [ Name=$p ]
             Field=p_type
           ]
+          like
           LiteralExpr [STRING] [%BRASS]
         ]
       ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
index 38af625..4ab59b1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q13_customer_distribution/q13_customer_distribution.3.ast
@@ -83,14 +83,13 @@
                       ]
                     ]
                     and
-                    FunctionCall null.not@1[
-                      FunctionCall tpch.like@2[
-                        FieldAccessor [
-                          Variable [ Name=$o ]
-                          Field=o_comment
-                        ]
-                        LiteralExpr [STRING] [%special%requests%]
+                    OperatorExpr [
+                      FieldAccessor [
+                        Variable [ Name=$o ]
+                        Field=o_comment
                       ]
+                      not_like
+                      LiteralExpr [STRING] [%special%requests%]
                     ]
                   ]
               )
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
index 1f8c630..f9f5c62 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.ast
@@ -8,11 +8,12 @@
     (
       SELECT ELEMENT [
       FunctionCall tpch.switch-case@5[
-        FunctionCall tpch.like@2[
+        OperatorExpr [
           FieldAccessor [
             Variable [ Name=$i ]
             Field=p_type
           ]
+          like
           LiteralExpr [STRING] [PROMO%]
         ]
         LiteralExpr [TRUE]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
index e00c9c7..aef4422 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tpch/q16_parts_supplier_relationship/q16_parts_supplier_relationship.3.ast
@@ -103,14 +103,13 @@
               LiteralExpr [STRING] [Brand#45]
             ]
             and
-            FunctionCall null.not@1[
-              FunctionCall tpch.like@2[
-                FieldAccessor [
-                  Variable [ Name=$p ]
-                  Field=p_type
-                ]
-                LiteralExpr [STRING] [MEDIUM POLISHED%]
+            OperatorExpr [
+              FieldAccessor [
+                Variable [ Name=$p ]
+                Field=p_type
               ]
+              not_like
+              LiteralExpr [STRING] [MEDIUM POLISHED%]
             ]
           ]
       )
@@ -133,14 +132,13 @@
           ]
         ]
         and
-        FunctionCall null.not@1[
-          FunctionCall tpch.like@2[
-            FieldAccessor [
-              Variable [ Name=$s ]
-              Field=s_comment
-            ]
-            LiteralExpr [STRING] [%Customer%Complaints%]
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=$s ]
+            Field=s_comment
           ]
+          not_like
+          LiteralExpr [STRING] [%Customer%Complaints%]
         ]
       ]
   )
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
index 65422b2..8f2374f 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
@@ -35,9 +35,9 @@
 
     public OperatorExpr() {
         super();
-        exprList = new ArrayList<Expression>();
-        exprBroadcastIdx = new ArrayList<Integer>();
-        opList = new ArrayList<OperatorType>();
+        exprList = new ArrayList<>();
+        exprBroadcastIdx = new ArrayList<>();
+        opList = new ArrayList<>();
     }
 
     public OperatorExpr(List<Expression> exprList, List<Integer> exprBroadcastIdx, List<OperatorType> opList,
@@ -83,47 +83,78 @@
         exprList.add(operand);
     }
 
-    public final static boolean opIsComparison(OperatorType t) {
-        return t == OperatorType.EQ || t == OperatorType.NEQ || t == OperatorType.GT || t == OperatorType.GE
-                || t == OperatorType.LT || t == OperatorType.LE;
+    public static final boolean opIsComparison(OperatorType t) {
+        boolean cmp = t == OperatorType.EQ || t == OperatorType.NEQ || t == OperatorType.GT;
+        cmp = cmp || t == OperatorType.GE || t == OperatorType.LT || t == OperatorType.LE;
+        return cmp;
     }
 
     public void addOperator(String strOp) {
-        if ("or".equals(strOp)) {
-            opList.add(OperatorType.OR);
-        } else if ("and".equals(strOp)) {
-            opList.add(OperatorType.AND);
-        } else if ("<".equals(strOp)) {
-            opList.add(OperatorType.LT);
-        } else if (">".equals(strOp)) {
-            opList.add(OperatorType.GT);
-        } else if ("<=".equals(strOp)) {
-            opList.add(OperatorType.LE);
-        } else if ("<=".equals(strOp)) {
-            opList.add(OperatorType.LE);
-        } else if (">=".equals(strOp)) {
-            opList.add(OperatorType.GE);
-        } else if ("=".equals(strOp)) {
-            opList.add(OperatorType.EQ);
-        } else if ("!=".equals(strOp)) {
-            opList.add(OperatorType.NEQ);
-        } else if ("+".equals(strOp)) {
-            opList.add(OperatorType.PLUS);
-        } else if ("-".equals(strOp)) {
-            opList.add(OperatorType.MINUS);
-        } else if ("*".equals(strOp)) {
-            opList.add(OperatorType.MUL);
-        } else if ("/".equals(strOp)) {
-            opList.add(OperatorType.DIV);
-        } else if ("%".equals(strOp)) {
-            opList.add(OperatorType.MOD);
-        } else if ("^".equals(strOp)) {
-            opList.add(OperatorType.CARET);
-        } else if ("idiv".equals(strOp)) {
-            opList.add(OperatorType.IDIV);
-        } else if ("~=".equals(strOp)) {
-            opList.add(OperatorType.FUZZY_EQ);
+        switch (strOp) {
+            case "or":
+                opList.add(OperatorType.OR);
+                break;
+            case "and":
+                opList.add(OperatorType.AND);
+                break;
+            case "<":
+                opList.add(OperatorType.LT);
+                break;
+            case ">":
+                opList.add(OperatorType.GT);
+                break;
+            case "<=":
+                opList.add(OperatorType.LE);
+                break;
+            case ">=":
+                opList.add(OperatorType.GE);
+                break;
+            case "=":
+                opList.add(OperatorType.EQ);
+                break;
+            case "!=":
+                opList.add(OperatorType.NEQ);
+                break;
+            case "+":
+                opList.add(OperatorType.PLUS);
+                break;
+            case "-":
+                opList.add(OperatorType.MINUS);
+                break;
+            case "*":
+                opList.add(OperatorType.MUL);
+                break;
+            case "/":
+                opList.add(OperatorType.DIV);
+                break;
+            case "%":
+                opList.add(OperatorType.MOD);
+                break;
+            case "^":
+                opList.add(OperatorType.CARET);
+                break;
+            case "idiv":
+                opList.add(OperatorType.IDIV);
+                break;
+            case "~=":
+                opList.add(OperatorType.FUZZY_EQ);
+                break;
+            case "like":
+                opList.add(OperatorType.LIKE);
+                break;
+            case "not_like":
+                opList.add(OperatorType.NOT_LIKE);
+                break;
+            case "in":
+                opList.add(OperatorType.IN);
+                break;
+            case "not_in":
+                opList.add(OperatorType.NOT_IN);
+                break;
+            default:
+                throw new UnsupportedOperationException("Unsupported operator: " + strOp);
         }
+
     }
 
     @Override
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/OperatorType.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/OperatorType.java
index c063665..bb15ecd 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/OperatorType.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/OperatorType.java
@@ -35,7 +35,11 @@
     MOD("%"),
     CARET("^"),
     IDIV("idiv"), // integer divide
-    FUZZY_EQ("~=");
+    FUZZY_EQ("~="),
+    LIKE("like"),
+    NOT_LIKE("not_like"),
+    IN("in"),
+    NOT_IN("not_in");
 
     private final String symbol;
 
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
index 8f41015..d9cdf58 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
@@ -34,6 +34,9 @@
         // Sets up parameters.
         setup(declaredFunctions, topExpr, metadataProvider, context);
 
+        // Rewrites like/not-like expressions.
+        rewriteOperatorExpression();
+
         // Inlines column aliases.
         inlineColumnAlias();
 
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
index fab5c07..4649986 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
@@ -51,6 +51,7 @@
 import org.apache.asterix.lang.sqlpp.parser.SqlppParserFactory;
 import org.apache.asterix.lang.sqlpp.rewrites.visitor.InlineColumnAliasVisitor;
 import org.apache.asterix.lang.sqlpp.rewrites.visitor.InlineWithExpressionVisitor;
+import org.apache.asterix.lang.sqlpp.rewrites.visitor.OperatorExpressionVisitor;
 import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppBuiltinFunctionRewriteVisitor;
 import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppGlobalAggregationSugarVisitor;
 import org.apache.asterix.lang.sqlpp.rewrites.visitor.SqlppGroupByVisitor;
@@ -95,6 +96,9 @@
 
         // Inlines WITH expressions.
         inlineWithExpressions();
+
+        // Rewrites like/not-like expressions.
+        rewriteOperatorExpression();
 
         // Rewrites SQL-92 global aggregations.
         rewriteGlobalAggregations();
@@ -149,6 +153,15 @@
         inlineWithExpressionVisitor.visit(topExpr, null);
     }
 
+    protected void rewriteOperatorExpression() throws AsterixException {
+        if (topExpr == null) {
+            return;
+        }
+        // Rewrites like/not-like operators into function call expressions.
+        OperatorExpressionVisitor likeExpressionVisitor = new OperatorExpressionVisitor(context);
+        likeExpressionVisitor.visit(topExpr, null);
+    }
+
     protected void inlineColumnAlias() throws AsterixException {
         if (topExpr == null) {
             return;
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/OperatorExpressionVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/OperatorExpressionVisitor.java
new file mode 100644
index 0000000..c591d72
--- /dev/null
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/OperatorExpressionVisitor.java
@@ -0,0 +1,98 @@
+/*
+ * 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.asterix.lang.sqlpp.rewrites.visitor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression.Quantifier;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
+import org.apache.asterix.lang.common.struct.OperatorType;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppExpressionScopingVisitor;
+
+public class OperatorExpressionVisitor extends AbstractSqlppExpressionScopingVisitor {
+
+    public OperatorExpressionVisitor(LangRewritingContext context) {
+        super(context);
+    }
+
+    @Override
+    public Expression visit(OperatorExpr operatorExpr, ILangExpression arg) throws AsterixException {
+
+        List<Expression> newExprList = new ArrayList<>();
+        for (Expression expr : operatorExpr.getExprList()) {
+            newExprList.add(expr.accept(this, operatorExpr));
+        }
+        operatorExpr.setExprList(newExprList);
+        if (operatorExpr.getExprList().size() == 2) {
+            OperatorType opType = operatorExpr.getOpList().get(0);
+            switch (opType) {
+                case LIKE:
+                case NOT_LIKE:
+                    return processLikeOperator(operatorExpr, opType);
+                case IN:
+                case NOT_IN:
+                    return processInOperator(operatorExpr, opType);
+                default:
+                    break;
+            }
+        }
+        return operatorExpr;
+    }
+
+    private Expression processLikeOperator(OperatorExpr operatorExpr, OperatorType opType) {
+        Expression likeExpr = new CallExpr(new FunctionSignature(null, "like", 2), operatorExpr.getExprList());
+        if (opType == OperatorType.LIKE) {
+            return likeExpr;
+        }
+        return new CallExpr(new FunctionSignature(null, "not", 1),
+                new ArrayList<Expression>(Collections.singletonList(likeExpr)));
+    }
+
+    private Expression processInOperator(OperatorExpr operatorExpr, OperatorType opType) {
+        VariableExpr bindingVar = new VariableExpr(context.newVariable());
+        Expression itemExpr = operatorExpr.getExprList().get(0);
+        Expression collectionExpr = operatorExpr.getExprList().get(1);
+        OperatorExpr comparison = new OperatorExpr();
+        comparison.addOperand(itemExpr);
+        comparison.addOperand(bindingVar);
+        comparison.setCurrentop(true);
+        if (opType == OperatorType.IN) {
+            comparison.addOperator("=");
+            return new QuantifiedExpression(Quantifier.SOME, new ArrayList<QuantifiedPair>(
+                    Collections.singletonList(new QuantifiedPair(bindingVar, collectionExpr))), comparison);
+        } else {
+            comparison.addOperator("!=");
+            return new QuantifiedExpression(Quantifier.EVERY, new ArrayList<QuantifiedPair>(
+                    Collections.singletonList(new QuantifiedPair(bindingVar, collectionExpr))), comparison);
+        }
+    }
+
+}
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index f587e50..ebcfeea 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -1662,6 +1662,7 @@
 
 Expression RelExpr()throws ParseException:
 {
+  boolean not = false;
   OperatorExpr op = null;
   Expression operand = null;
   boolean broadcast = false;
@@ -1679,24 +1680,28 @@
     }
 
     (
-      LOOKAHEAD(2)( <LT> | <GT> | <LE> | <GE> | <EQ> | <NE> |<SIMILAR>)
+      LOOKAHEAD(2)( <LT> | <GT> | <LE> | <GE> | <EQ> | <NE> |<SIMILAR> | (<NOT> { not = true; })? (<LIKE>|<IN>))
         {
           String mhint = getHint(token);
           if (mhint != null) {
             if (mhint.equals(INDEXED_NESTED_LOOP_JOIN_HINT)) {
-            annotation = IndexedNLJoinExpressionAnnotation.INSTANCE;
-          } else if (mhint.equals(SKIP_SECONDARY_INDEX_SEARCH_HINT)) {
-            annotation = SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE;
+                annotation = IndexedNLJoinExpressionAnnotation.INSTANCE;
+            } else if (mhint.equals(SKIP_SECONDARY_INDEX_SEARCH_HINT)) {
+                annotation = SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE;
+            }
           }
-        }
+          String operator = token.image.toLowerCase();
+          if(not){
+            operator = "not_" + operator;
+          }
           if (op == null) {
             op = new OperatorExpr();
             op.addOperand(operand, broadcast);
-          op.setCurrentop(true);
-          broadcast = false;
+            op.setCurrentop(true);
+            broadcast = false;
           }
-        op.addOperator(token.image);
-      }
+          op.addOperator(operator);
+        }
 
        operand = IsExpr()
       {
@@ -2770,6 +2775,7 @@
   | <ASC : "asc">
   | <AT : "at">
   | <AUTOGENERATED : "autogenerated">
+  | <BETWEEN : "between">
   | <BTREE : "btree">
   | <BY : "by">
   | <CASE : "case">
@@ -2823,6 +2829,7 @@
   | <LEFT : "left">
   | <LETTING : "letting">
   | <LET : "let">
+  | <LIKE : "like">
   | <LIMIT : "limit">
   | <LOAD : "load">
   | <NEST : "nest">

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/974
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I497c4420431460bc461937dd5fc58956e1fad6ea
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyingyi@gmail.com>

Mime
View raw message