asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject incubator-asterixdb git commit: ASTERIXDB-1277 - Updated interval desc sort to be based on end point.
Date Wed, 27 Jan 2016 01:46:38 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 8fc8bf8b5 -> bf34d187d


ASTERIXDB-1277 - Updated interval desc sort to be based on end point.

The default interval sort order is now the following:
  asc - start point asc, end point asc
  desc - end point desc, start point desc

Change-Id: I61d00850e0bc8ebc611366b95e2aa4da07d21d55
Reviewed-on: https://asterix-gerrit.ics.uci.edu/598
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Taewoo Kim <wangsaeu@gmail.com>


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

Branch: refs/heads/master
Commit: bf34d187dd0077b81c01126bbd4b83a15519a425
Parents: 8fc8bf8
Author: Preston Carman <prestonc@apache.org>
Authored: Tue Jan 26 13:57:51 2016 -0800
Committer: Preston Carman <prestonc@apache.org>
Committed: Tue Jan 26 17:40:05 2016 -0800

----------------------------------------------------------------------
 .../queries/comparison/ComparisonQueries.xml    | 209 +++++++++++++++++++
 .../interval_order/interval_order.1.ddl.aql     |  22 ++
 .../interval_order/interval_order.2.update.aql  |  18 ++
 .../interval_order/interval_order.3.query.aql   |  31 +++
 .../interval_order/interval_order.4.query.aql   |  31 +++
 .../interval_order/interval_order.3.adm         |   7 +
 .../interval_order/interval_order.4.adm         |   7 +
 .../src/test/resources/runtimets/testsuite.xml  | 196 +----------------
 ...tervalAscPartialBinaryComparatorFactory.java |  69 ++++++
 ...ervalDescPartialBinaryComparatorFactory.java |  70 +++++++
 ...AIntervalPartialBinaryComparatorFactory.java |  65 ------
 .../AObjectAscBinaryComparatorFactory.java      |   2 +-
 .../AObjectDescBinaryComparatorFactory.java     |  13 ++
 .../ListItemBinaryComparatorFactory.java        |   2 +-
 .../serde/AIntervalSerializerDeserializer.java  |  12 +-
 .../AqlBinaryComparatorFactoryProvider.java     |  15 +-
 .../AbstractComparisonEvaluator.java            |   4 +-
 17 files changed, 506 insertions(+), 267 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml b/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
new file mode 100644
index 0000000..6c3cc06
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/ComparisonQueries.xml
@@ -0,0 +1,209 @@
+        <test-case FilePath="comparison">
+            <compilation-unit name="year_month_duration_order">
+                <output-dir compare="Text">year_month_duration_order</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="datetime_order">
+                <output-dir compare="Text">datetime_order</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="datetime_range">
+                <output-dir compare="Text">datetime_range</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="datetime_tzeq">
+                <output-dir compare="Text">datetime_tzeq</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="interval_order">
+                <output-dir compare="Text">interval_order</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="time_order">
+                <output-dir compare="Text">time_order</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="date_order">
+                <output-dir compare="Text">date_order</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="double">
+                <output-dir compare="Text">double</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="double_gte_01">
+                <output-dir compare="Text">double_gte_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="double_null">
+                <output-dir compare="Text">double_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="eq_01">
+                <output-dir compare="Text">eq_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="float">
+                <output-dir compare="Text">float</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="float_null">
+                <output-dir compare="Text">float_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="gt_01">
+                <output-dir compare="Text">gt_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="gte_01">
+                <output-dir compare="Text">gte_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int16">
+                <output-dir compare="Text">int16</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int16_null">
+                <output-dir compare="Text">int16_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int32">
+                <output-dir compare="Text">int32</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int32_null">
+                <output-dir compare="Text">int32_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int64">
+                <output-dir compare="Text">int64</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int64_null">
+                <output-dir compare="Text">int64_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int8">
+                <output-dir compare="Text">int8</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="int8_null">
+                <output-dir compare="Text">int8_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="lt_01">
+                <output-dir compare="Text">lt_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="lte_01">
+                <output-dir compare="Text">lte_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="neq_01">
+                <output-dir compare="Text">neq_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <!--
+        <test-case FilePath="comparison">
+          <compilation-unit name="numeric-comparison_01">
+            <output-dir compare="Text">numeric-comparison_01</output-dir>
+          </compilation-unit>
+        </test-case>
+        -->
+        <test-case FilePath="comparison">
+            <compilation-unit name="string">
+                <output-dir compare="Text">string</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="string_null">
+                <output-dir compare="Text">string_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_equality">
+                <output-dir compare="Text">issue363_equality</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_duration">
+                <output-dir compare="Text">issue363_inequality_duration</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the DURATION type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_interval">
+                <output-dir compare="Text">issue363_inequality_interval</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the INTERVAL type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_point">
+                <output-dir compare="Text">issue363_inequality_point</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the POINT type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_line">
+                <output-dir compare="Text">issue363_inequality_line</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the LINE type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_polygon">
+                <output-dir compare="Text">issue363_inequality_polygon</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the POLYGON type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_rectangle">
+                <output-dir compare="Text">issue363_inequality_rectangle</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the RECTANGLE type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="issue363_inequality_circle">
+                <output-dir compare="Text">issue363_inequality_circle</output-dir>
+                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the CIRCLE type are not defined</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="binary">
+                <output-dir compare="Text">binary</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="binary_null">
+                <output-dir compare="Text">binary_null</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="comparison">
+            <compilation-unit name="uuid_1">
+                <output-dir compare="Text">uuid_1</output-dir>
+            </compilation-unit>
+        </test-case>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.1.ddl.aql
new file mode 100644
index 0000000..950d2b4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.1.ddl.aql
@@ -0,0 +1,22 @@
+/*
+ * 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 dataverse test if exists;
+
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.3.query.aql
new file mode 100644
index 0000000..8ccca18
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.3.query.aql
@@ -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.
+ */
+use dataverse test;
+
+let $id1 := interval-from-date("2002-01-01", "2003-01-01")
+let $id2 := interval-from-date("2006-01-01", "2010-01-01")
+let $id3 := interval-from-date("2001-01-01", "2010-01-01")
+let $id4 := interval-from-date("2003-01-01", "2008-01-01")
+let $id5 := interval-from-date("2002-01-01", "2010-01-01")
+let $id6 := interval-from-date("2004-01-01", "2009-01-01")
+let $id7 := interval-from-date("2003-01-01", "2008-01-01")
+
+for $id in [$id1, $id2, $id3, $id4, $id5, $id6, $id7]
+order by $id
+return $id;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.4.query.aql
new file mode 100644
index 0000000..e0d9410
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/interval_order/interval_order.4.query.aql
@@ -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.
+ */
+use dataverse test;
+
+let $id1 := interval-from-date("2002-01-01", "2003-01-01")
+let $id2 := interval-from-date("2006-01-01", "2010-01-01")
+let $id3 := interval-from-date("2001-01-01", "2010-01-01")
+let $id4 := interval-from-date("2003-01-01", "2008-01-01")
+let $id5 := interval-from-date("2002-01-01", "2010-01-01")
+let $id6 := interval-from-date("2004-01-01", "2009-01-01")
+let $id7 := interval-from-date("2003-01-01", "2008-01-01")
+
+for $id in [$id1, $id2, $id3, $id4, $id5, $id6, $id7]
+order by $id desc
+return $id;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.3.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.3.adm b/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.3.adm
new file mode 100644
index 0000000..35b6077
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.3.adm
@@ -0,0 +1,7 @@
+interval-date("2001-01-01, 2010-01-01")
+interval-date("2002-01-01, 2003-01-01")
+interval-date("2002-01-01, 2010-01-01")
+interval-date("2003-01-01, 2008-01-01")
+interval-date("2003-01-01, 2008-01-01")
+interval-date("2004-01-01, 2009-01-01")
+interval-date("2006-01-01, 2010-01-01")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.4.adm b/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.4.adm
new file mode 100644
index 0000000..b8b3d7a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/comparison/interval_order/interval_order.4.adm
@@ -0,0 +1,7 @@
+interval-date("2006-01-01, 2010-01-01")
+interval-date("2002-01-01, 2010-01-01")
+interval-date("2001-01-01, 2010-01-01")
+interval-date("2004-01-01, 2009-01-01")
+interval-date("2003-01-01, 2008-01-01")
+interval-date("2003-01-01, 2008-01-01")
+interval-date("2002-01-01, 2003-01-01")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 2e0c073..a20dc15 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -18,6 +18,7 @@
  !-->
 <!DOCTYPE test-suite [
 
+<!ENTITY ComparisonQueries SYSTEM "queries/comparison/ComparisonQueries.xml">
 <!ENTITY RecordsQueries SYSTEM "queries/records/RecordsQueries.xml">
 <!ENTITY DeepEqualQueries SYSTEM "queries/comparison/deep_equal/DeepEqualQueries.xml">
 ]>
@@ -971,200 +972,7 @@
         </test-case>
     </test-group>
     <test-group name="comparison">
-        <test-case FilePath="comparison">
-            <compilation-unit name="year_month_duration_order">
-                <output-dir compare="Text">year_month_duration_order</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="datetime_order">
-                <output-dir compare="Text">datetime_order</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="datetime_range">
-                <output-dir compare="Text">datetime_range</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="datetime_tzeq">
-                <output-dir compare="Text">datetime_tzeq</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="double">
-                <output-dir compare="Text">double</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="double_gte_01">
-                <output-dir compare="Text">double_gte_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="double_null">
-                <output-dir compare="Text">double_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="eq_01">
-                <output-dir compare="Text">eq_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="float">
-                <output-dir compare="Text">float</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="float_null">
-                <output-dir compare="Text">float_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="gt_01">
-                <output-dir compare="Text">gt_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="gte_01">
-                <output-dir compare="Text">gte_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int16">
-                <output-dir compare="Text">int16</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int16_null">
-                <output-dir compare="Text">int16_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int32">
-                <output-dir compare="Text">int32</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int32_null">
-                <output-dir compare="Text">int32_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int64">
-                <output-dir compare="Text">int64</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int64_null">
-                <output-dir compare="Text">int64_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int8">
-                <output-dir compare="Text">int8</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="int8_null">
-                <output-dir compare="Text">int8_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="lt_01">
-                <output-dir compare="Text">lt_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="lte_01">
-                <output-dir compare="Text">lte_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="neq_01">
-                <output-dir compare="Text">neq_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <!--
-        <test-case FilePath="comparison">
-          <compilation-unit name="numeric-comparison_01">
-            <output-dir compare="Text">numeric-comparison_01</output-dir>
-          </compilation-unit>
-        </test-case>
-        -->
-        <test-case FilePath="comparison">
-            <compilation-unit name="string">
-                <output-dir compare="Text">string</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="string_null">
-                <output-dir compare="Text">string_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_equality">
-                <output-dir compare="Text">issue363_equality</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_duration">
-                <output-dir compare="Text">issue363_inequality_duration</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the DURATION type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_interval">
-                <output-dir compare="Text">issue363_inequality_interval</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the INTERVAL type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_point">
-                <output-dir compare="Text">issue363_inequality_point</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the POINT type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_line">
-                <output-dir compare="Text">issue363_inequality_line</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the LINE type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_polygon">
-                <output-dir compare="Text">issue363_inequality_polygon</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the POLYGON type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_rectangle">
-                <output-dir compare="Text">issue363_inequality_rectangle</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the RECTANGLE type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="issue363_inequality_circle">
-                <output-dir compare="Text">issue363_inequality_circle</output-dir>
-                <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException: Comparison operations (GT, GE, LT, and LE) for the CIRCLE type are not defined</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="binary">
-                <output-dir compare="Text">binary</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="binary_null">
-                <output-dir compare="Text">binary_null</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="comparison">
-            <compilation-unit name="uuid_1">
-                <output-dir compare="Text">uuid_1</output-dir>
-            </compilation-unit>
-        </test-case>
+        &ComparisonQueries;
     </test-group>
     <test-group name="constructor">
         <test-case FilePath="constructor">

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalAscPartialBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalAscPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalAscPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..6efc7ff
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalAscPartialBinaryComparatorFactory.java
@@ -0,0 +1,69 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+
+public class AIntervalAscPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AIntervalAscPartialBinaryComparatorFactory INSTANCE = new AIntervalAscPartialBinaryComparatorFactory();
+
+    private AIntervalAscPartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                // The ascending interval comparator sorts intervals first by start point, then by end point.
+                // If the interval have the same point values, the final comparison orders the intervals by type
+                // (datetime, date, time).
+                int c = Long.compare(
+                        AInt64SerializerDeserializer.getLong(b1,
+                                s1 + AIntervalSerializerDeserializer.getIntervalStartOffset()),
+                        AInt64SerializerDeserializer.getLong(b2,
+                                s2 + AIntervalSerializerDeserializer.getIntervalStartOffset()));
+                if (c == 0) {
+                    c = Long.compare(
+                            AInt64SerializerDeserializer.getLong(b1,
+                                    s1 + AIntervalSerializerDeserializer.getIntervalEndOffset()),
+                            AInt64SerializerDeserializer.getLong(b2,
+                                    s2 + AIntervalSerializerDeserializer.getIntervalEndOffset()));
+                    if (c == 0) {
+                        c = Byte.compare(b1[s1 + AIntervalSerializerDeserializer.getIntervalTagOffset()], b2[s2
+                                + AIntervalSerializerDeserializer.getIntervalTagOffset()]);
+                    }
+                }
+                return c;
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalDescPartialBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalDescPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalDescPartialBinaryComparatorFactory.java
new file mode 100644
index 0000000..9a09623
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalDescPartialBinaryComparatorFactory.java
@@ -0,0 +1,70 @@
+/*
+ * 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.dataflow.data.nontagged.comparators;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+
+public class AIntervalDescPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AIntervalDescPartialBinaryComparatorFactory INSTANCE = new AIntervalDescPartialBinaryComparatorFactory();
+
+    private AIntervalDescPartialBinaryComparatorFactory() {
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
+     */
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new IBinaryComparator() {
+
+            @Override
+            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+                // The descending interval comparator sorts intervals first by end point, then by start point.
+                // If the interval have the same point values, the final comparison orders the intervals by type
+                // (time, date, datetime).
+                int c = Long.compare(
+                        AInt64SerializerDeserializer.getLong(b1,
+                                s1 + AIntervalSerializerDeserializer.getIntervalEndOffset()),
+                        AInt64SerializerDeserializer.getLong(b2,
+                                s2 + AIntervalSerializerDeserializer.getIntervalEndOffset()));
+                if (c == 0) {
+                    c = Long.compare(
+                            AInt64SerializerDeserializer.getLong(b1,
+                                    s1 + AIntervalSerializerDeserializer.getIntervalStartOffset()),
+                            AInt64SerializerDeserializer.getLong(b2,
+                                    s2 + AIntervalSerializerDeserializer.getIntervalStartOffset()));
+                    if (c == 0) {
+                        c = Byte.compare(b1[s1 + AIntervalSerializerDeserializer.getIntervalTagOffset()],
+                                b2[s2 + AIntervalSerializerDeserializer.getIntervalTagOffset()]);
+                    }
+                }
+                // Since the comparisons are based on ascending order, the result is reversed.
+                return -c;
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java
deleted file mode 100644
index f7c4428..0000000
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AIntervalPartialBinaryComparatorFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.dataflow.data.nontagged.comparators;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
-
-public class AIntervalPartialBinaryComparatorFactory implements IBinaryComparatorFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public static final AIntervalPartialBinaryComparatorFactory INSTANCE = new AIntervalPartialBinaryComparatorFactory();
-
-    private AIntervalPartialBinaryComparatorFactory() {
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory#createBinaryComparator()
-     */
-    @Override
-    public IBinaryComparator createBinaryComparator() {
-        return new IBinaryComparator() {
-
-            @Override
-            public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
-                int c = Double.compare(
-                        AInt64SerializerDeserializer.getLong(b1,
-                                s1 + AIntervalSerializerDeserializer.getIntervalStartOffset()),
-                        AInt64SerializerDeserializer.getLong(b2,
-                                s2 + AIntervalSerializerDeserializer.getIntervalStartOffset()));
-                if (c == 0) {
-                    c = Double.compare(
-                            AInt64SerializerDeserializer.getLong(b1,
-                                    s1 + AIntervalSerializerDeserializer.getIntervalEndOffset()),
-                            AInt64SerializerDeserializer.getLong(b2,
-                                    s2 + AIntervalSerializerDeserializer.getIntervalEndOffset()));
-                    if (c == 0) {
-                        c = Byte.compare(b1[s1 + 16], b2[s2 + 16]);
-                    }
-                }
-                return c;
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
index ad3be0e..6a24cf3 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
@@ -89,7 +89,7 @@ public class AObjectAscBinaryComparatorFactory implements IBinaryComparatorFacto
             final IBinaryComparator ascDurationComp = ADurationPartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
             // INTERVAL
-            final IBinaryComparator ascIntervalComp = AIntervalPartialBinaryComparatorFactory.INSTANCE
+            final IBinaryComparator ascIntervalComp = AIntervalAscPartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
             // LINE
             final IBinaryComparator ascLineComp = ALinePartialBinaryComparatorFactory.INSTANCE.createBinaryComparator();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
index 6030908..5db1bcd 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.comparators;
 
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -36,8 +38,19 @@ public class AObjectDescBinaryComparatorFactory implements IBinaryComparatorFact
         return new ABinaryComparator() {
             final IBinaryComparator ascComp = AObjectAscBinaryComparatorFactory.INSTANCE.createBinaryComparator();
 
+            // INTERVAL
+            // Interval asc and desc comparator factories are not the inverse of each other.
+            // Thus, we need to specify the interval desc comparator factory for descending comparisons.
+            final IBinaryComparator descIntervalComp = AIntervalDescPartialBinaryComparatorFactory.INSTANCE
+                    .createBinaryComparator();
+
             @Override
             public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException {
+                ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b1[s1]);
+                ATypeTag tag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b2[s2]);
+                if (tag1 == ATypeTag.INTERVAL && tag2 == ATypeTag.INTERVAL) {
+                    return descIntervalComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+                }
                 return -ascComp.compare(b1, s1, l1, b2, s2, l2);
             }
         };

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
index 767a343..77b8b3a 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
@@ -67,7 +67,7 @@ public class ListItemBinaryComparatorFactory implements IBinaryComparatorFactory
                     .createBinaryComparator();
             final IBinaryComparator ascDurationComp = ADurationPartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
-            final IBinaryComparator ascIntervalComp = AIntervalPartialBinaryComparatorFactory.INSTANCE
+            final IBinaryComparator ascIntervalComp = AIntervalAscPartialBinaryComparatorFactory.INSTANCE
                     .createBinaryComparator();
             final IBinaryComparator ascLineComp = ALinePartialBinaryComparatorFactory.INSTANCE.createBinaryComparator();
             final IBinaryComparator ascPointComp = APointPartialBinaryComparatorFactory.INSTANCE

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
index 5d08d52..94a8917 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AIntervalSerializerDeserializer.java
@@ -30,6 +30,10 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
 
     private static final long serialVersionUID = 1L;
 
+    private static final int INTERVAL_START_POINT_OFFSET = 0;
+    private static final int INTERVAL_END_POINT_OFFSET = INTERVAL_START_POINT_OFFSET + Long.BYTES;
+    private static final int INTERVAL_TAG_OFFSET = INTERVAL_END_POINT_OFFSET + Long.BYTES;
+
     public static final AIntervalSerializerDeserializer INSTANCE = new AIntervalSerializerDeserializer();
 
     private AIntervalSerializerDeserializer() {
@@ -65,11 +69,15 @@ public class AIntervalSerializerDeserializer implements ISerializerDeserializer<
     }
 
     public static int getIntervalStartOffset() {
-        return 0;
+        return INTERVAL_START_POINT_OFFSET;
     }
 
     public static int getIntervalEndOffset() {
-        return 8;
+        return INTERVAL_END_POINT_OFFSET;
+    }
+
+    public static int getIntervalTagOffset() {
+        return INTERVAL_TAG_OFFSET;
     }
 
     public static byte getIntervalTimeType(byte[] data, int offset) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
index 8f43a17..44851e3 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
@@ -23,7 +23,8 @@ import java.io.Serializable;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ABinaryComparator;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ACirclePartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ADurationPartialBinaryComparatorFactory;
-import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalPartialBinaryComparatorFactory;
+import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalAscPartialBinaryComparatorFactory;
+import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalDescPartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ALinePartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.AObjectAscBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.AObjectDescBinaryComparatorFactory;
@@ -172,7 +173,7 @@ public class AqlBinaryComparatorFactoryProvider implements IBinaryComparatorFact
                 return addOffset(ADurationPartialBinaryComparatorFactory.INSTANCE, ascending);
             }
             case INTERVAL: {
-                return addOffset(AIntervalPartialBinaryComparatorFactory.INSTANCE, ascending);
+                return addOffset(intervalBinaryComparatorFactory(ascending), ascending);
             }
             case UUID: {
                 return addOffset(AUUIDPartialBinaryComparatorFactory.INSTANCE, ascending);
@@ -224,4 +225,14 @@ public class AqlBinaryComparatorFactoryProvider implements IBinaryComparatorFact
         }
     }
 
+    private IBinaryComparatorFactory intervalBinaryComparatorFactory(boolean ascending) {
+        // Intervals have separate binary comparator factories, since asc is primarily based on start point
+        // and desc is similarly based on end point.
+        if (ascending) {
+            return AIntervalAscPartialBinaryComparatorFactory.INSTANCE;
+        } else {
+            return AIntervalDescPartialBinaryComparatorFactory.INSTANCE;
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/bf34d187/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index 356a77b..b2a91ea 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -23,7 +23,7 @@ import java.io.DataOutput;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ABinaryComparator;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ACirclePartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ADurationPartialBinaryComparatorFactory;
-import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalPartialBinaryComparatorFactory;
+import org.apache.asterix.dataflow.data.nontagged.comparators.AIntervalAscPartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.ALinePartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.APoint3DPartialBinaryComparatorFactory;
 import org.apache.asterix.dataflow.data.nontagged.comparators.APointPartialBinaryComparatorFactory;
@@ -85,7 +85,7 @@ public abstract class AbstractComparisonEvaluator implements ICopyEvaluator {
             .createBinaryComparator();
     protected IBinaryComparator durationBinaryComp = ADurationPartialBinaryComparatorFactory.INSTANCE
             .createBinaryComparator();
-    protected IBinaryComparator intervalBinaryComp = AIntervalPartialBinaryComparatorFactory.INSTANCE
+    protected IBinaryComparator intervalBinaryComp = AIntervalAscPartialBinaryComparatorFactory.INSTANCE
             .createBinaryComparator();
     protected IBinaryComparator lineBinaryComparator = ALinePartialBinaryComparatorFactory.INSTANCE
             .createBinaryComparator();


Mime
View raw message