Yingyi Bu has submitted this change and it was merged.

Change subject: ASTERIXDB-1223: let incompatiable comparisons return null.
......................................................................


ASTERIXDB-1223: let incompatiable comparisons return null.

- make null/missing/true/false case-insensitive;
- add tests for incompatible comparisons;
- add tests for group-by/order-by with MISSING valued keys.

Change-Id: I8130d505f810631231d3755941ce4de64313501b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/912
Reviewed-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
---
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/incompatible/incompatible.1.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.1.ddl.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.2.update.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.3.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by/group-by.1.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.1.ddl.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.2.update.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.3.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by/order-by.1.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/incompatible/incompatible.1.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by-from-dataset/group-by-from-dataset.1.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by/group-by.1.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by-from-dataset/order-by-from-dataset.1.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by/order-by.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
18 files changed, 335 insertions(+), 13 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Looks good to me, but someone else must approve; Verified



diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/incompatible/incompatible.1.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/incompatible/incompatible.1.query.sqlpp
new file mode 100644
index 0000000..f741b05
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/incompatible/incompatible.1.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+{
+ "null_with_missing": NULL > MISSING,
+ "missing_with_int": MISSING < 25,
+ "null_with_int": NULL > 25,
+ "int_with_str": 99 < '25',
+ "str_with_int": '25'< 99,
+ "str_with_list": "hello" < [],
+ "int_with_list": 99 < [99],
+ "list_with_list": [] < {}
+};
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.1.ddl.sqlpp
new file mode 100644
index 0000000..f311302
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.1.ddl.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+
+
+drop database test if exists;
+create database test;
+
+use test;
+
+create type TestType as {
+   b: int64
+}
+
+create table data(TestType) primary key b;
+
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.2.update.sqlpp
new file mode 100644
index 0000000..978894a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.2.update.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+INSERT INTO data (
+[ {"a":1, "b":2},
+  {"a": NULL, "b": 7},
+  {"a":1, "b":3},
+  {"b":4},
+  {"a": NULL, "b": 6},
+  {"b":5},
+  {"a": "1", "b":8},
+  {"a": 3.0, "b":9}
+]
+)
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.3.query.sqlpp
new file mode 100644
index 0000000..3340b64
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+SELECT a AS a, MAX(d.b) as max, COUNT(1) as count
+FROM data AS d
+GROUP BY d.a AS a
+ORDER BY a;
+
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by/group-by.1.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by/group-by.1.query.sqlpp
new file mode 100644
index 0000000..a36f87c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by/group-by.1.query.sqlpp
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+
+WITH data AS
+[ {"a":1, "b":2},
+  {"a": NULL, "b": 7},
+  {"a":1, "b":3},
+  {"b":4},
+  {"a": NULL, "b": 6},
+  {"b":5},
+  {"a": "1", "b":8},
+  {"a": 3.0, "b":9}
+]
+
+SELECT a AS a, MAX(d.b) as max, COUNT(1) as count
+FROM data AS d
+GROUP BY d.a AS a
+ORDER BY a;
+
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.1.ddl.sqlpp
new file mode 100644
index 0000000..f311302
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.1.ddl.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+
+
+drop database test if exists;
+create database test;
+
+use test;
+
+create type TestType as {
+   b: int64
+}
+
+create table data(TestType) primary key b;
+
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.2.update.sqlpp
new file mode 100644
index 0000000..3a461ae
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.2.update.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+INSERT INTO data (
+[ {"a":1, "b":2},
+  {"a": NULL, "b": 7},
+  {"b":4},
+  {"a": "1", "b":8},
+  {"a": 3.0, "b":9}
+]
+);
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.3.query.sqlpp
new file mode 100644
index 0000000..3758ff2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+USE test;
+
+
+SELECT VALUE d
+FROM data AS d
+ORDER BY d.a;
+
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by/order-by.1.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by/order-by.1.query.sqlpp
new file mode 100644
index 0000000..567ca72
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by/order-by.1.query.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+
+WITH data AS
+[ {"a":1, "b":2},
+  {"a": NULL, "b": 7},
+  {"b":4},
+  {"a": "1", "b":8},
+  {"a": 3.0, "b":9}
+]
+
+SELECT VALUE d
+FROM data AS d
+ORDER BY d.a;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/incompatible/incompatible.1.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/incompatible/incompatible.1.adm
new file mode 100644
index 0000000..25bbfd6
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/incompatible/incompatible.1.adm
@@ -0,0 +1 @@
+{ "null_with_int": null, "int_with_str": null, "str_with_int": null, 
"str_with_list": null, "int_with_list": null, "list_with_list": null }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by-from-dataset/group-by-from-dataset.1.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by-from-dataset/group-by-from-dataset.1.adm
new file mode 100644
index 0000000..afb229f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by-from-dataset/group-by-from-dataset.1.adm
@@ -0,0 +1,5 @@
+{ "max": 5, "count": 2 }
+{ "max": 7, "count": 2, "a": null }
+{ "max": 3, "count": 2, "a": 1 }
+{ "max": 9, "count": 1, "a": 3.0d }
+{ "max": 8, "count": 1, "a": "1" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by/group-by.1.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by/group-by.1.adm
new file mode 100644
index 0000000..339b112
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by/group-by.1.adm
@@ -0,0 +1,5 @@
+{ "count": 2, "max": 5 }
+{ "count": 2, "a": null, "max": 7 }
+{ "count": 2, "a": 1, "max": 3 }
+{ "count": 1, "a": 3.0d, "max": 9 }
+{ "count": 1, "a": "1", "max": 8 }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by-from-dataset/order-by-from-dataset.1.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by-from-dataset/order-by-from-dataset.1.adm
new file mode 100644
index 0000000..4cbb761
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by-from-dataset/order-by-from-dataset.1.adm
@@ -0,0 +1,5 @@
+{ "b": 4 }
+{ "b": 7, "a": null }
+{ "b": 2, "a": 1 }
+{ "b": 9, "a": 3.0d }
+{ "b": 8, "a": "1" }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by/order-by.1.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by/order-by.1.adm
new file mode 100644
index 0000000..63285af
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by/order-by.1.adm
@@ -0,0 +1,5 @@
+{ "b": 4 }
+{ "a": null, "b": 7 }
+{ "a": 1, "b": 2 }
+{ "a": 3.0d, "b": 9 }
+{ "a": "1", "b": 8 }
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 0c08ffd..dc4a17d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -967,6 +967,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="comparison">
+      <compilation-unit name="incompatible">
+        <output-dir compare="Text">incompatible</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="comparison">
       <compilation-unit name="int16">
         <output-dir compare="Text">int16</output-dir>
       </compilation-unit>
@@ -3649,6 +3654,16 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="null-missing">
+      <compilation-unit name="group-by">
+        <output-dir compare="Text">group-by</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="null-missing">
+      <compilation-unit name="group-by-from-dataset">
+        <output-dir compare="Text">group-by-from-dataset</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="null-missing">
       <compilation-unit name="length">
         <output-dir compare="Text">length</output-dir>
       </compilation-unit>
@@ -3659,6 +3674,16 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="null-missing">
+      <compilation-unit name="order-by">
+        <output-dir compare="Text">order-by</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="null-missing">
+      <compilation-unit name="order-by-from-dataset">
+        <output-dir compare="Text">order-by-from-dataset</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="null-missing">
       <compilation-unit name="scan-collection">
         <output-dir compare="Text">scan-collection</output-dir>
       </compilation-unit>
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.html 
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
index 797ee69..e5a0cea 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
@@ -210,7 +210,7 @@
  <TR>
   <TD>
    <PRE>
-&lt;DEFAULT,IN_DBL_BRACE&gt; TOKEN : {
+&lt;DEFAULT,IN_DBL_BRACE&gt; TOKEN [IGNORE_CASE] : {
 &lt;MISSING: "missing"&gt;
 | &lt;NULL: "null"&gt;
 | &lt;TRUE: "true"&gt;
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index fc94d8b..4961834 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -2869,7 +2869,7 @@
 }
 
 <DEFAULT,IN_DBL_BRACE>
-TOKEN :
+TOKEN [IGNORE_CASE]:
 {
   <MISSING : "missing">
   |  <NULL : "null">
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index ebf255f..04944dc 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -22,6 +22,7 @@
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
+import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
@@ -53,6 +54,9 @@
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<ABoolean> serde = 
AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
+    @SuppressWarnings("unchecked")
+    protected ISerializerDeserializer<ANull> nullSerde = 
AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ANULL);
 
     public AbstractComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
             IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext 
context) throws AlgebricksException {
@@ -76,18 +80,17 @@
             checkTotallyOrderable();
         }
 
-        ABoolean b;
-        // Checks whether two types are comparable
-        if (comparabilityCheck()) {
-            // Two types can be compared
-            int r = compareResults();
-            b = getComparisonResult(r) ? ABoolean.TRUE : ABoolean.FALSE;
-        } else {
-            // result:FALSE - two types cannot be compared. Thus we return 
FALSE since this is equality comparison
-            b = ABoolean.FALSE;
-        }
         try {
-            serde.serialize(b, out);
+            // Checks whether two types are comparable
+            if (comparabilityCheck()) {
+                // Two types can be compared
+                int r = compareResults();
+                ABoolean b = getComparisonResult(r) ? ABoolean.TRUE : 
ABoolean.FALSE;
+                serde.serialize(b, out);
+            } else {
+                // result:NULL - two types cannot be compared.
+                nullSerde.serialize(ANull.NULL, out);
+            }
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8130d505f810631231d3755941ce4de64313501b
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyin...@gmail.com>
Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyin...@gmail.com>

Reply via email to