asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject incubator-asterixdb git commit: ASTERIXDB-1223: let incompatiable comparisons return null.
Date Wed, 08 Jun 2016 16:21:32 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 14796d195 -> e311a6346


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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


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

Branch: refs/heads/master
Commit: e311a634634da975d0c9e93d5d56d24a99b12a3f
Parents: 14796d1
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Tue Jun 7 18:23:16 2016 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Wed Jun 8 09:21:01 2016 -0700

----------------------------------------------------------------------
 .../incompatible/incompatible.1.query.sqlpp     | 29 ++++++++++++++++
 .../group-by-from-dataset.1.ddl.sqlpp           | 32 +++++++++++++++++
 .../group-by-from-dataset.2.update.sqlpp        | 32 +++++++++++++++++
 .../group-by-from-dataset.3.query.sqlpp         | 26 ++++++++++++++
 .../group-by/group-by.1.query.sqlpp             | 36 ++++++++++++++++++++
 .../order-by-from-dataset.1.ddl.sqlpp           | 32 +++++++++++++++++
 .../order-by-from-dataset.2.update.sqlpp        | 29 ++++++++++++++++
 .../order-by-from-dataset.3.query.sqlpp         | 26 ++++++++++++++
 .../order-by/order-by.1.query.sqlpp             | 31 +++++++++++++++++
 .../comparison/incompatible/incompatible.1.adm  |  1 +
 .../group-by-from-dataset.1.adm                 |  5 +++
 .../null-missing/group-by/group-by.1.adm        |  5 +++
 .../order-by-from-dataset.1.adm                 |  5 +++
 .../null-missing/order-by/order-by.1.adm        |  5 +++
 .../resources/runtimets/testsuite_sqlpp.xml     | 25 ++++++++++++++
 .../src/main/javacc/SQLPP.html                  |  2 +-
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj |  2 +-
 .../AbstractComparisonEvaluator.java            | 25 ++++++++------
 18 files changed, 335 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/incompatible/incompatible.1.query.sqlpp
----------------------------------------------------------------------
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": [] < {}
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.1.ddl.sqlpp
----------------------------------------------------------------------
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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.2.update.sqlpp
----------------------------------------------------------------------
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}
+]
+)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by-from-dataset/group-by-from-dataset.3.query.sqlpp
----------------------------------------------------------------------
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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/group-by/group-by.1.query.sqlpp
----------------------------------------------------------------------
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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.1.ddl.sqlpp
----------------------------------------------------------------------
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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.2.update.sqlpp
----------------------------------------------------------------------
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}
+]
+);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by-from-dataset/order-by-from-dataset.3.query.sqlpp
----------------------------------------------------------------------
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;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/null-missing/order-by/order-by.1.query.sqlpp
----------------------------------------------------------------------
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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/results/comparison/incompatible/incompatible.1.adm
----------------------------------------------------------------------
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 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by-from-dataset/group-by-from-dataset.1.adm
----------------------------------------------------------------------
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" }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/group-by/group-by.1.adm
----------------------------------------------------------------------
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 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by-from-dataset/order-by-from-dataset.1.adm
----------------------------------------------------------------------
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" }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/results/null-missing/order-by/order-by.1.adm
----------------------------------------------------------------------
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 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
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>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
----------------------------------------------------------------------
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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
----------------------------------------------------------------------
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 @@ TOKEN :
 }
 
 <DEFAULT,IN_DBL_BRACE>
-TOKEN :
+TOKEN [IGNORE_CASE]:
 {
   <MISSING : "missing">
   |  <NULL : "null">

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/e311a634/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
----------------------------------------------------------------------
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 java.io.DataOutput;
 
 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 @@ public abstract class AbstractComparisonEvaluator implements IScalarEvaluator
{
     @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 @@ public abstract class AbstractComparisonEvaluator implements IScalarEvaluator
{
             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);
         }


Mime
View raw message