Ali Alsuliman has uploaded a new change for review.

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

Change subject: [ASTERIXDB-2516][RT] array deep comparison (ordering)
......................................................................

[ASTERIXDB-2516][RT] array deep comparison (ordering)

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
Add support for physical array deep comparison.
- Refactored and renamed 
AObjectAscBinaryComparatorFactory/AObjectDescBinaryComparatorFactory
- Added test cases

Change-Id: Ib369a4dd22f32bfca4bd2c0cbf987529c0bafa6d
---
A asterixdb/asterix-app/data/complex/arrays1.adm
A asterixdb/asterix-app/data/complex/arrays2.adm
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/io/PersistedResourceRegistry.java
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.1.ddl.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.2.update.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.3.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.4.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.5.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.6.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.7.ddl.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.3.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.4.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.5.adm
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.6.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparator.java
C 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparatorFactory.java
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparator.java
R 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparatorFactory.java
R 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AbstractAGenericBinaryComparatorFactory.java
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
21 files changed, 426 insertions(+), 58 deletions(-)


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

diff --git a/asterixdb/asterix-app/data/complex/arrays1.adm 
b/asterixdb/asterix-app/data/complex/arrays1.adm
new file mode 100644
index 0000000..fb74f83
--- /dev/null
+++ b/asterixdb/asterix-app/data/complex/arrays1.adm
@@ -0,0 +1,21 @@
+{"id":1, "name":"Margarita", "dept_ids": [3, 2, 8]}
+{"id":2, "name":"Isac", "dept_ids": [99, 12, 14, 15, 77]}
+{"id":3, "name":"Emory", "dept_ids": [33, 11, 3, 16]}
+{"id":4, "name":"Nicholas", "dept_ids": []}
+{"id":5, "name":"Von", "dept_ids": [4]}
+{"id":6, "name":"Willis", "dept_ids": [1, 5, 6]}
+{"id":7, "name":"Suzanna", "dept_ids": [9, 5, 2]}
+{"id":8, "name":"Nicole", "dept_ids": [33, 11, 3, 16]}
+{"id":9, "name":"Woodrow", "dept_ids": [3, 2, 8]}
+{"id":10, "name":"Bram", "dept_ids": []}
+{"id":11, "name":"Nicholas", "dept_ids": null}
+{"id":12, "name":"John", "dept_ids": [2]}
+{"id":13, "name":"Steve", "dept_ids": [8, 2]}
+{"id":14, "name":"Jay", "dept_ids": [4]}
+{"id":15, "name":"Jim", "dept_ids": null}
+{"id":16, "name":"Wail", "dept_ids": [9, 5, 2]}
+{"id":17, "name":"Jim"}
+{"id":18, "name":"Kayle", "dept_ids": [8, 2, 1, 7, 9]}
+{"id":19, "name":"Mart"}
+{"id":20, "name":"Mai", "dept_ids": [1, 5, 9]}
+{"id":21, "name":"Ken", "dept_ids": [3, 5, 8]}
\ No newline at end of file
diff --git a/asterixdb/asterix-app/data/complex/arrays2.adm 
b/asterixdb/asterix-app/data/complex/arrays2.adm
new file mode 100644
index 0000000..fe56a69
--- /dev/null
+++ b/asterixdb/asterix-app/data/complex/arrays2.adm
@@ -0,0 +1,21 @@
+{"id":1, "name":"Margarita", "dept_ids": [4]}
+{"id":2, "name":"Isac", "dept_ids": [99, 12, 14, 15]}
+{"id":3, "name":"Emory", "dept_ids": [33, 3, 16]}
+{"id":4, "name":"Nicholas", "dept_ids": [1, 5, 6]}
+{"id":5, "name":"Von", "dept_ids": [3, 2, 8]}
+{"id":6, "name":"Willis", "dept_ids": []}
+{"id":7, "name":"Suzanna", "dept_ids": [4]}
+{"id":8, "name":"Nicole", "dept_ids": [33, 11, 3, 16]}
+{"id":9, "name":"Woodrow", "dept_ids": null}
+{"id":10, "name":"Bram", "dept_ids": []}
+{"id":11, "name":"Nicholas", "dept_ids":[3, 2, 8] }
+{"id":12, "name":"John", "dept_ids": [9, 5, 2]}
+{"id":13, "name":"Steve"}
+{"id":14, "name":"Jay", "dept_ids": [9, 5, 2]}
+{"id":15, "name":"Jim", "dept_ids": null}
+{"id":16, "name":"Wail", "dept_ids": [2]}
+{"id":17, "name":"Jim", "dept_ids": [8, 2]}
+{"id":18, "name":"Kayle"}
+{"id":19, "name":"Mart", "dept_ids": [8, 2, 1, 7, 9]}
+{"id":20, "name":"Mai", "dept_ids": [1, 5, 9]}
+{"id":21, "name":"Ken", "dept_ids": [3, 5, 8]}
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/io/PersistedResourceRegistry.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/io/PersistedResourceRegistry.java
index 11d1b26..7bd5620 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/io/PersistedResourceRegistry.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/io/PersistedResourceRegistry.java
@@ -40,8 +40,8 @@
 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;
+import 
org.apache.asterix.dataflow.data.nontagged.comparators.AGenericAscBinaryComparatorFactory;
+import 
org.apache.asterix.dataflow.data.nontagged.comparators.AGenericDescBinaryComparatorFactory;
 import 
org.apache.asterix.dataflow.data.nontagged.comparators.APoint3DPartialBinaryComparatorFactory;
 import 
org.apache.asterix.dataflow.data.nontagged.comparators.APointPartialBinaryComparatorFactory;
 import 
org.apache.asterix.dataflow.data.nontagged.comparators.APolygonPartialBinaryComparatorFactory;
@@ -189,8 +189,8 @@
         REGISTERED_CLASSES.put("AIntervalDescPartialBinaryComparatorFactory",
                 AIntervalDescPartialBinaryComparatorFactory.class);
         REGISTERED_CLASSES.put("ALinePartialBinaryComparatorFactory", 
ALinePartialBinaryComparatorFactory.class);
-        REGISTERED_CLASSES.put("AObjectAscBinaryComparatorFactory", 
AObjectAscBinaryComparatorFactory.class);
-        REGISTERED_CLASSES.put("AObjectDescBinaryComparatorFactory", 
AObjectDescBinaryComparatorFactory.class);
+        REGISTERED_CLASSES.put("AObjectAscBinaryComparatorFactory", 
AGenericAscBinaryComparatorFactory.class);
+        REGISTERED_CLASSES.put("AObjectDescBinaryComparatorFactory", 
AGenericDescBinaryComparatorFactory.class);
         REGISTERED_CLASSES.put("APoint3DPartialBinaryComparatorFactory", 
APoint3DPartialBinaryComparatorFactory.class);
         REGISTERED_CLASSES.put("APointPartialBinaryComparatorFactory", 
APointPartialBinaryComparatorFactory.class);
         REGISTERED_CLASSES.put("APolygonPartialBinaryComparatorFactory", 
APolygonPartialBinaryComparatorFactory.class);
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.1.ddl.sqlpp
new file mode 100644
index 0000000..7842019
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.1.ddl.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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+use test;
+
+create type closedType as closed {
+id:int,
+name:string,
+dept_ids:[int]?
+};
+
+create type openType as {
+id:int,
+name:string
+};
+
+create dataset closedDs(closedType) primary key id;
+create dataset openDs(openType) primary key id;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.2.update.sqlpp
new file mode 100644
index 0000000..98b5875
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.2.update.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+load dataset closedDs using localfs 
(("path"="asterix_nc1://data/complex/arrays1.adm"),("format"="adm"));
+load dataset openDs using localfs 
(("path"="asterix_nc1://data/complex/arrays1.adm"),("format"="adm"));
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.3.query.sqlpp
new file mode 100644
index 0000000..8ed8d27
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.3.query.sqlpp
@@ -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.
+ */
+
+use test;
+
+select value v from openDs v order by v.dept_ids, v.id;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.4.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.4.query.sqlpp
new file mode 100644
index 0000000..2376bcb
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.4.query.sqlpp
@@ -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.
+ */
+
+use test;
+
+select value v from closedDs v order by v.dept_ids, v.id;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.5.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.5.query.sqlpp
new file mode 100644
index 0000000..a9a00d7
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.5.query.sqlpp
@@ -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.
+ */
+
+use test;
+
+select value v from openDs v order by v.dept_ids desc, v.id;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.6.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.6.query.sqlpp
new file mode 100644
index 0000000..6af915c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.6.query.sqlpp
@@ -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.
+ */
+
+use test;
+
+select value v from closedDs v order by v.dept_ids desc, v.id;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.7.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.7.ddl.sqlpp
new file mode 100755
index 0000000..269f673
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/sorting/arrays/arrays.7.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.3.adm
new file mode 100644
index 0000000..3cb68d9
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.3.adm
@@ -0,0 +1,21 @@
+{ "id": 17, "name": "Jim" }
+{ "id": 19, "name": "Mart" }
+{ "id": 11, "name": "Nicholas", "dept_ids": null }
+{ "id": 15, "name": "Jim", "dept_ids": null }
+{ "id": 4, "name": "Nicholas", "dept_ids": [  ] }
+{ "id": 10, "name": "Bram", "dept_ids": [  ] }
+{ "id": 6, "name": "Willis", "dept_ids": [ 1, 5, 6 ] }
+{ "id": 20, "name": "Mai", "dept_ids": [ 1, 5, 9 ] }
+{ "id": 12, "name": "John", "dept_ids": [ 2 ] }
+{ "id": 1, "name": "Margarita", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 9, "name": "Woodrow", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 21, "name": "Ken", "dept_ids": [ 3, 5, 8 ] }
+{ "id": 5, "name": "Von", "dept_ids": [ 4 ] }
+{ "id": 14, "name": "Jay", "dept_ids": [ 4 ] }
+{ "id": 13, "name": "Steve", "dept_ids": [ 8, 2 ] }
+{ "id": 18, "name": "Kayle", "dept_ids": [ 8, 2, 1, 7, 9 ] }
+{ "id": 7, "name": "Suzanna", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 16, "name": "Wail", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 3, "name": "Emory", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 8, "name": "Nicole", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 2, "name": "Isac", "dept_ids": [ 99, 12, 14, 15, 77 ] }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.4.adm
new file mode 100644
index 0000000..3cb68d9
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.4.adm
@@ -0,0 +1,21 @@
+{ "id": 17, "name": "Jim" }
+{ "id": 19, "name": "Mart" }
+{ "id": 11, "name": "Nicholas", "dept_ids": null }
+{ "id": 15, "name": "Jim", "dept_ids": null }
+{ "id": 4, "name": "Nicholas", "dept_ids": [  ] }
+{ "id": 10, "name": "Bram", "dept_ids": [  ] }
+{ "id": 6, "name": "Willis", "dept_ids": [ 1, 5, 6 ] }
+{ "id": 20, "name": "Mai", "dept_ids": [ 1, 5, 9 ] }
+{ "id": 12, "name": "John", "dept_ids": [ 2 ] }
+{ "id": 1, "name": "Margarita", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 9, "name": "Woodrow", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 21, "name": "Ken", "dept_ids": [ 3, 5, 8 ] }
+{ "id": 5, "name": "Von", "dept_ids": [ 4 ] }
+{ "id": 14, "name": "Jay", "dept_ids": [ 4 ] }
+{ "id": 13, "name": "Steve", "dept_ids": [ 8, 2 ] }
+{ "id": 18, "name": "Kayle", "dept_ids": [ 8, 2, 1, 7, 9 ] }
+{ "id": 7, "name": "Suzanna", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 16, "name": "Wail", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 3, "name": "Emory", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 8, "name": "Nicole", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 2, "name": "Isac", "dept_ids": [ 99, 12, 14, 15, 77 ] }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.5.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.5.adm
new file mode 100644
index 0000000..efdea4b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.5.adm
@@ -0,0 +1,21 @@
+{ "id": 2, "name": "Isac", "dept_ids": [ 99, 12, 14, 15, 77 ] }
+{ "id": 3, "name": "Emory", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 8, "name": "Nicole", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 7, "name": "Suzanna", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 16, "name": "Wail", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 18, "name": "Kayle", "dept_ids": [ 8, 2, 1, 7, 9 ] }
+{ "id": 13, "name": "Steve", "dept_ids": [ 8, 2 ] }
+{ "id": 5, "name": "Von", "dept_ids": [ 4 ] }
+{ "id": 14, "name": "Jay", "dept_ids": [ 4 ] }
+{ "id": 21, "name": "Ken", "dept_ids": [ 3, 5, 8 ] }
+{ "id": 1, "name": "Margarita", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 9, "name": "Woodrow", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 12, "name": "John", "dept_ids": [ 2 ] }
+{ "id": 20, "name": "Mai", "dept_ids": [ 1, 5, 9 ] }
+{ "id": 6, "name": "Willis", "dept_ids": [ 1, 5, 6 ] }
+{ "id": 4, "name": "Nicholas", "dept_ids": [  ] }
+{ "id": 10, "name": "Bram", "dept_ids": [  ] }
+{ "id": 11, "name": "Nicholas", "dept_ids": null }
+{ "id": 15, "name": "Jim", "dept_ids": null }
+{ "id": 17, "name": "Jim" }
+{ "id": 19, "name": "Mart" }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.6.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.6.adm
new file mode 100644
index 0000000..efdea4b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/sorting/arrays/arrays.6.adm
@@ -0,0 +1,21 @@
+{ "id": 2, "name": "Isac", "dept_ids": [ 99, 12, 14, 15, 77 ] }
+{ "id": 3, "name": "Emory", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 8, "name": "Nicole", "dept_ids": [ 33, 11, 3, 16 ] }
+{ "id": 7, "name": "Suzanna", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 16, "name": "Wail", "dept_ids": [ 9, 5, 2 ] }
+{ "id": 18, "name": "Kayle", "dept_ids": [ 8, 2, 1, 7, 9 ] }
+{ "id": 13, "name": "Steve", "dept_ids": [ 8, 2 ] }
+{ "id": 5, "name": "Von", "dept_ids": [ 4 ] }
+{ "id": 14, "name": "Jay", "dept_ids": [ 4 ] }
+{ "id": 21, "name": "Ken", "dept_ids": [ 3, 5, 8 ] }
+{ "id": 1, "name": "Margarita", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 9, "name": "Woodrow", "dept_ids": [ 3, 2, 8 ] }
+{ "id": 12, "name": "John", "dept_ids": [ 2 ] }
+{ "id": 20, "name": "Mai", "dept_ids": [ 1, 5, 9 ] }
+{ "id": 6, "name": "Willis", "dept_ids": [ 1, 5, 6 ] }
+{ "id": 4, "name": "Nicholas", "dept_ids": [  ] }
+{ "id": 10, "name": "Bram", "dept_ids": [  ] }
+{ "id": 11, "name": "Nicholas", "dept_ids": null }
+{ "id": 15, "name": "Jim", "dept_ids": null }
+{ "id": 17, "name": "Jim" }
+{ "id": 19, "name": "Mart" }
\ No newline at end of file
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 c905e0c..959813b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -115,6 +115,13 @@
       </compilation-unit>
     </test-case>
   </test-group>
+  <test-group name="sorting">
+    <test-case FilePath="sorting">
+      <compilation-unit name="arrays">
+        <output-dir compare="Text">arrays</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
   <test-group name="explain">
     <test-case FilePath="explain">
       <compilation-unit name="explain_simple">
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparator.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparator.java
index 1d20d72..057dff9 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparator.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparator.java
@@ -20,14 +20,24 @@
 
 import java.io.IOException;
 
+import org.apache.asterix.builders.AbvsBuilderFactory;
+import org.apache.asterix.dataflow.data.common.ListAccessorUtil;
+import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
+import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AbstractCollectionType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.om.types.hierachy.ITypeConvertComputer;
+import org.apache.asterix.om.util.container.IObjectFactory;
+import org.apache.asterix.om.util.container.IObjectPool;
+import org.apache.asterix.om.util.container.ListObjectPool;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.accessors.PointableBinaryComparatorFactory;
+import org.apache.hyracks.data.std.api.IMutableValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.data.std.primitive.BytePointable;
 import org.apache.hyracks.data.std.primitive.DoublePointable;
@@ -35,6 +45,7 @@
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 
 class AGenericAscBinaryComparator implements IBinaryComparator {
@@ -94,17 +105,33 @@
 
     // a storage to promote a value
     private final ArrayBackedValueStorage castBuffer;
-    private final IAType leftType;
-    private final IAType rightType;
+
+    // TODO(ali): extract IObjectFactory factories into a separate unit and 
share
+    private static final IObjectFactory<IPointable, Void> VOID_FACTORY = 
(type) -> new VoidPointable();
+    private static final IObjectFactory<IMutableValueStorage, ATypeTag> 
STORAGE_FACTORY = new AbvsBuilderFactory();
+
+    // these fields can be null
+    protected final IAType leftType;
+    protected final IAType rightType;
+    private final IObjectPool<IMutableValueStorage, ATypeTag> storageAllocator;
+    private final IObjectPool<IPointable, Void> voidPointableAllocator;
 
     AGenericAscBinaryComparator(IAType leftType, IAType rightType) {
+        // factory should have already made sure to get the actual type
         this.leftType = leftType;
         this.rightType = rightType;
         this.castBuffer = new ArrayBackedValueStorage();
+        this.storageAllocator = new ListObjectPool<>(STORAGE_FACTORY);
+        this.voidPointableAllocator = new ListObjectPool<>(VOID_FACTORY);
     }
 
     @Override
     public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) 
throws HyracksDataException {
+        return compare(leftType, b1, s1, l1, rightType, b2, s2, l2);
+    }
+
+    protected int compare(IAType leftType, byte[] b1, int s1, int l1, IAType 
rightType, byte[] b2, int s2, int l2)
+            throws HyracksDataException {
         // normally, comparing between MISSING and non-MISSING values should 
return MISSING as the result.
         // however, this comparator is used by order-by/group-by/distinct-by.
         // therefore, inside this method, we return an order between two 
values even if one value is MISSING.
@@ -305,15 +332,68 @@
                 return ascDurationComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, 
l2 - 1);
             }
             case INTERVAL: {
-                return ascIntervalComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, 
l2 - 1);
+                return compareInterval(b1, s1, l1, b2, s2, l2);
             }
             case BINARY: {
                 return ascByteArrayComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 
1, l2 - 1);
             }
+            case ARRAY:
+                return compareArrays(leftType, b1, s1, l1, rightType, b2, s2, 
l2);
             default: {
                 // we include typeTag in comparison to compare between two 
type to enforce some ordering
                 return rawComp.compare(b1, s1, l1, b2, s2, l2);
             }
         }
     }
+
+    protected int compareInterval(byte[] b1, int s1, int l1, byte[] b2, int 
s2, int l2) throws HyracksDataException {
+        return ascIntervalComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 1);
+    }
+
+    private int compareArrays(IAType leftType, byte[] b1, int s1, int l1, 
IAType rightType, byte[] b2, int s2, int l2)
+            throws HyracksDataException {
+        if (leftType == null || rightType == null) {
+            return rawComp.compare(b1, s1, l1, b2, s2, l2);
+        }
+        int leftNumItems = ListAccessorUtil.numberOfItems(b1, s1);
+        int rightNumItems = ListAccessorUtil.numberOfItems(b2, s2);
+        IAType leftArrayType = TypeComputeUtils.getActualType(leftType);
+        if (leftArrayType.getTypeTag() == ATypeTag.ANY) {
+            leftArrayType = 
DefaultOpenFieldType.getDefaultOpenFieldType(ATypeTag.ARRAY);
+        }
+        IAType rightArrayType = TypeComputeUtils.getActualType(rightType);
+        if (rightArrayType.getTypeTag() == ATypeTag.ANY) {
+            rightArrayType = 
DefaultOpenFieldType.getDefaultOpenFieldType(ATypeTag.ARRAY);
+        }
+        IAType leftItemType = ((AbstractCollectionType) 
leftArrayType).getItemType();
+        IAType rightItemType = ((AbstractCollectionType) 
rightArrayType).getItemType();
+        ATypeTag leftItemTag = leftItemType.getTypeTag();
+        ATypeTag rightItemTag = rightItemType.getTypeTag();
+        // TODO(ali): could be optimized to not need pointable when changing 
comparator to be non-tagged & no visitable
+        IPointable leftItem = voidPointableAllocator.allocate(null);
+        IPointable rightItem = voidPointableAllocator.allocate(null);
+        // TODO(ali): optimize to not need this storage, will require 
optimizing records comparison to not use visitable
+        ArrayBackedValueStorage leftStorage = (ArrayBackedValueStorage) 
storageAllocator.allocate(null);
+        ArrayBackedValueStorage rightStorage = (ArrayBackedValueStorage) 
storageAllocator.allocate(null);
+        int result;
+        try {
+            for (int i = 0; i < leftNumItems && i < rightNumItems; i++) {
+                ListAccessorUtil.getItem(b1, s1, i, ATypeTag.ARRAY, 
leftItemTag, leftItem, leftStorage);
+                ListAccessorUtil.getItem(b2, s2, i, ATypeTag.ARRAY, 
rightItemTag, rightItem, rightStorage);
+                result = compare(leftItemType, leftItem.getByteArray(), 
leftItem.getStartOffset(), leftItem.getLength(),
+                        rightItemType, rightItem.getByteArray(), 
rightItem.getStartOffset(), rightItem.getLength());
+                if (result != 0) {
+                    return result;
+                }
+            }
+            return Integer.compare(leftNumItems, rightNumItems);
+        } catch (IOException e) {
+            throw HyracksDataException.create(e);
+        } finally {
+            storageAllocator.free(rightStorage);
+            storageAllocator.free(leftStorage);
+            voidPointableAllocator.free(rightItem);
+            voidPointableAllocator.free(leftItem);
+        }
+    }
 }
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparatorFactory.java
similarity index 77%
copy from 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
copy to 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparatorFactory.java
index 2fc866a..fe80351 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericAscBinaryComparatorFactory.java
@@ -19,18 +19,24 @@
 package org.apache.asterix.dataflow.data.nontagged.comparators;
 
 import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.IJsonSerializable;
 import org.apache.hyracks.api.io.IPersistedResourceRegistry;
 
 import com.fasterxml.jackson.databind.JsonNode;
 
-public class AObjectDescBinaryComparatorFactory extends 
AObjectAscBinaryComparatorFactory {
+public class AGenericAscBinaryComparatorFactory extends 
AbstractAGenericBinaryComparatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    public AObjectDescBinaryComparatorFactory(IAType leftType, IAType 
rightType) {
-        super(leftType, rightType, false);
+    public AGenericAscBinaryComparatorFactory(IAType leftType, IAType 
rightType) {
+        super(leftType, rightType);
+    }
+
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new AGenericAscBinaryComparator(leftType, rightType);
     }
 
     @Override
@@ -40,6 +46,6 @@
 
     public static IJsonSerializable fromJson(IPersistedResourceRegistry 
registry, JsonNode json)
             throws HyracksDataException {
-        return convertToObject(registry, json, false);
+        return convertToObject(registry, json, true);
     }
 }
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparator.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparator.java
index afe1349..1d94016 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparator.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparator.java
@@ -18,12 +18,11 @@
  */
 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.asterix.om.types.IAType;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
+// TODO(ali): refactor in a better way
 class AGenericDescBinaryComparator extends AGenericAscBinaryComparator {
 
     // interval asc and desc comparators are not the inverse of each other.
@@ -37,11 +36,10 @@
 
     @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 -super.compare(b1, s1, l1, b2, s2, l2);
+        return -compare(leftType, b1, s1, l1, rightType, b2, s2, l2);
+    }
+
+    protected int compareInterval(byte[] b1, int s1, int l1, byte[] b2, int 
s2, int l2) throws HyracksDataException {
+        return -descIntervalComp.compare(b1, s1 + 1, l1 - 1, b2, s2 + 1, l2 - 
1);
     }
 }
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparatorFactory.java
similarity index 78%
rename from 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
rename to 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparatorFactory.java
index 2fc866a..1c81589 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectDescBinaryComparatorFactory.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AGenericDescBinaryComparatorFactory.java
@@ -19,18 +19,24 @@
 package org.apache.asterix.dataflow.data.nontagged.comparators;
 
 import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.IJsonSerializable;
 import org.apache.hyracks.api.io.IPersistedResourceRegistry;
 
 import com.fasterxml.jackson.databind.JsonNode;
 
-public class AObjectDescBinaryComparatorFactory extends 
AObjectAscBinaryComparatorFactory {
+public class AGenericDescBinaryComparatorFactory extends 
AbstractAGenericBinaryComparatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    public AObjectDescBinaryComparatorFactory(IAType leftType, IAType 
rightType) {
-        super(leftType, rightType, false);
+    public AGenericDescBinaryComparatorFactory(IAType leftType, IAType 
rightType) {
+        super(leftType, rightType);
+    }
+
+    @Override
+    public IBinaryComparator createBinaryComparator() {
+        return new AGenericDescBinaryComparator(leftType, rightType);
     }
 
     @Override
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AbstractAGenericBinaryComparatorFactory.java
similarity index 63%
rename from 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
rename to 
asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AbstractAGenericBinaryComparatorFactory.java
index 06bdd2a..140db22 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AObjectAscBinaryComparatorFactory.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/AbstractAGenericBinaryComparatorFactory.java
@@ -18,8 +18,8 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.comparators;
 
+import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
 import org.apache.asterix.om.types.IAType;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.IJsonSerializable;
@@ -28,33 +28,16 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
-public class AObjectAscBinaryComparatorFactory implements 
IBinaryComparatorFactory {
+public abstract class AbstractAGenericBinaryComparatorFactory implements 
IBinaryComparatorFactory {
 
     private static final long serialVersionUID = 1L;
     // these fields can be null
-    private final IAType leftType;
-    private final IAType rightType;
-    private final boolean ascending;
+    protected final IAType leftType;
+    protected final IAType rightType;
 
-    public AObjectAscBinaryComparatorFactory(IAType leftType, IAType 
rightType) {
-        this(leftType, rightType, true);
-    }
-
-    protected AObjectAscBinaryComparatorFactory(IAType leftType, IAType 
rightType, boolean ascending) {
-        this.leftType = leftType;
-        this.rightType = rightType;
-        this.ascending = ascending;
-    }
-
-    @Override
-    public IBinaryComparator createBinaryComparator() {
-        return ascending ? new AGenericAscBinaryComparator(leftType, rightType)
-                : new AGenericDescBinaryComparator(leftType, rightType);
-    }
-
-    @Override
-    public JsonNode toJson(IPersistedResourceRegistry registry) throws 
HyracksDataException {
-        return convertToJson(registry, getClass(), serialVersionUID);
+    AbstractAGenericBinaryComparatorFactory(IAType leftType, IAType rightType) 
{
+        this.leftType = leftType == null ? null : 
TypeComputeUtils.getActualType(leftType);
+        this.rightType = rightType == null ? null : 
TypeComputeUtils.getActualType(rightType);
     }
 
     JsonNode convertToJson(IPersistedResourceRegistry registry, Class<? 
extends IJsonSerializable> clazz, long version)
@@ -69,18 +52,13 @@
         return jsonNode;
     }
 
-    public static IJsonSerializable fromJson(IPersistedResourceRegistry 
registry, JsonNode json)
-            throws HyracksDataException {
-        return convertToObject(registry, json, true);
-    }
-
     static IJsonSerializable convertToObject(IPersistedResourceRegistry 
registry, JsonNode json, boolean asc)
             throws HyracksDataException {
         JsonNode leftNode = json.get("leftType");
         JsonNode rightNode = json.get("rightType");
         IAType leftType = leftNode == null || leftNode.isNull() ? null : 
(IAType) registry.deserialize(leftNode);
         IAType rightType = rightNode == null || rightNode.isNull() ? null : 
(IAType) registry.deserialize(rightNode);
-        return asc ? new AObjectAscBinaryComparatorFactory(leftType, rightType)
-                : new AObjectDescBinaryComparatorFactory(leftType, rightType);
+        return asc ? new AGenericAscBinaryComparatorFactory(leftType, 
rightType)
+                : new AGenericDescBinaryComparatorFactory(leftType, rightType);
     }
 }
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
index 22cb6ee..d42a1d3 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/BinaryComparatorFactoryProvider.java
@@ -25,8 +25,8 @@
 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;
+import 
org.apache.asterix.dataflow.data.nontagged.comparators.AGenericAscBinaryComparatorFactory;
+import 
org.apache.asterix.dataflow.data.nontagged.comparators.AGenericDescBinaryComparatorFactory;
 import 
org.apache.asterix.dataflow.data.nontagged.comparators.APoint3DPartialBinaryComparatorFactory;
 import 
org.apache.asterix.dataflow.data.nontagged.comparators.APointPartialBinaryComparatorFactory;
 import 
org.apache.asterix.dataflow.data.nontagged.comparators.APolygonPartialBinaryComparatorFactory;
@@ -111,7 +111,7 @@
     @Override
     public IBinaryComparatorFactory getBinaryComparatorFactory(Object 
leftType, Object rightType, boolean ascending) {
         // During a comparison, since proper type promotion among several 
numeric types are required,
-        // we will use AObjectAscBinaryComparatorFactory, instead of using a 
specific comparator
+        // we will use AGenericAscBinaryComparatorFactory, instead of using a 
specific comparator
         return createGenericBinaryComparatorFactory((IAType) leftType, 
(IAType) rightType, ascending);
     }
 
@@ -177,9 +177,9 @@
     private IBinaryComparatorFactory 
createGenericBinaryComparatorFactory(IAType leftType, IAType rightType,
             boolean ascending) {
         if (ascending) {
-            return new AObjectAscBinaryComparatorFactory(leftType, rightType);
+            return new AGenericAscBinaryComparatorFactory(leftType, rightType);
         } else {
-            return new AObjectDescBinaryComparatorFactory(leftType, rightType);
+            return new AGenericDescBinaryComparatorFactory(leftType, 
rightType);
         }
     }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib369a4dd22f32bfca4bd2c0cbf987529c0bafa6d
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ali Alsuliman <[email protected]>

Reply via email to