Range connector update with order by hint.

Change-Id: I1b36f6dea801950c39bf63f27a0ec70d3584c5b7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/254
Reviewed-by: Ildar Absalyamov <ildar.absalyamov@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Steven Jacobs <sjaco002@ucr.edu>
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
index 0184a65..4c47c7d 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/AqlTranslator.java
@@ -192,8 +192,7 @@
     private Dataverse activeDefaultDataverse;
     private final List<FunctionDecl> declaredFunctions;
 
-    public AqlTranslator(List<Statement> aqlStatements, SessionConfig conf)
-            throws MetadataException, AsterixException {
+    public AqlTranslator(List<Statement> aqlStatements, SessionConfig conf) throws MetadataException, AsterixException {
         this.aqlStatements = aqlStatements;
         this.sessionConfig = conf;
         declaredFunctions = getDeclaredFunctions(aqlStatements);
@@ -1736,7 +1735,8 @@
             CompiledLoadFromFileStatement cls = new CompiledLoadFromFileStatement(dataverseName, loadStmt
                     .getDatasetName().getValue(), loadStmt.getAdapter(), loadStmt.getProperties(),
                     loadStmt.dataIsAlreadySorted());
-            JobSpecification spec = APIFramework.compileQuery(null, metadataProvider, null, 0, null, sessionConfig, cls);
+            JobSpecification spec = APIFramework
+                    .compileQuery(null, metadataProvider, null, 0, null, sessionConfig, cls);
             MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
             bActiveTxn = false;
             if (spec != null) {
@@ -1834,8 +1834,7 @@
         Pair<Query, Integer> reWrittenQuery = APIFramework.reWriteQuery(declaredFunctions, metadataProvider, query,
                 sessionConfig);
 
-        // Query Compilation (happens under the same ongoing metadata
-        // transaction)
+        // Query Compilation (happens under the same ongoing metadata transaction)
         JobSpecification spec = APIFramework.compileQuery(declaredFunctions, metadataProvider, reWrittenQuery.first,
                 reWrittenQuery.second, stmt == null ? null : stmt.getDatasetName(), sessionConfig, stmt);
 
@@ -2193,8 +2192,8 @@
                         // In this case (the normal case), we don't use the
                         // "response" JSONObject - just stream the results
                         // to the "out" PrintWriter
-                        if (sessionConfig.fmt() == OutputFormat.CSV &&
-                            sessionConfig.is(SessionConfig.FORMAT_CSV_HEADER)) {
+                        if (sessionConfig.fmt() == OutputFormat.CSV
+                                && sessionConfig.is(SessionConfig.FORMAT_CSV_HEADER)) {
                             ResultUtils.displayCSVHeader(metadataProvider.findOutputRecordType(), sessionConfig);
                         }
                         ResultUtils.displayResults(resultReader, sessionConfig);
diff --git a/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-numeric-desc.aql b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-numeric-desc.aql
new file mode 100644
index 0000000..1d13a10
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-numeric-desc.aql
@@ -0,0 +1,27 @@
+/*
+ *  Description     : The hint is to use the range connector
+ *                  : This test is intended to verify that the range connector is used instead of single node merge.
+ *  Expected Result : Success
+ *  Date            : 1th May 2015
+ */
+
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+for $user in dataset TwitterUsers
+/*+ range [400, 150, 100] */
+order by $user.friends_count desc
+return $user;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-numeric.aql b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-numeric.aql
new file mode 100644
index 0000000..1bf07ab
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-numeric.aql
@@ -0,0 +1,27 @@
+/*
+ *  Description     : The hint is to use the range connector
+ *                  : This test is intended to verify that the range connector is used instead of single node merge.
+ *  Expected Result : Success
+ *  Date            : 1th May 2015
+ */
+
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+for $user in dataset TwitterUsers
+/*+ range [100, 150, 400] */
+order by $user.friends_count
+return $user;
diff --git a/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-string-desc.aql b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-string-desc.aql
new file mode 100644
index 0000000..7d61041
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-string-desc.aql
@@ -0,0 +1,27 @@
+/*
+ *  Description     : The hint is to use the range connector
+ *                  : This test is intended to verify that the range connector is used instead of single node merge.
+ *  Expected Result : Success
+ *  Date            : 1th May 2015
+ */
+
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+for $user in dataset TwitterUsers
+/*+ range ["Nb", "F", "Ci"] */
+order by $user.screen-name desc
+return $user;
diff --git a/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-string.aql b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-string.aql
new file mode 100644
index 0000000..71de562
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/range-connector/sort-hint-on-closed-string.aql
@@ -0,0 +1,27 @@
+/*
+ *  Description     : The hint is to use the range connector
+ *                  : This test is intended to verify that the range connector is used instead of single node merge.
+ *  Expected Result : Success
+ *  Date            : 1th May 2015
+ */
+
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+for $user in dataset TwitterUsers
+/*+ range ["Ci", "F", "Nb"] */
+order by $user.screen-name
+return $user;
diff --git a/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-numeric-desc.plan b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-numeric-desc.plan
new file mode 100644
index 0000000..cdedfde
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-numeric-desc.plan
@@ -0,0 +1,12 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- RANGE_PARTITION_MERGE_EXCHANGE [$$4(DESC)] SPLIT COUNT:3  |PARTITIONED|
+        -- STABLE_SORT [$$4(DESC)]  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+            -- ASSIGN  |PARTITIONED|
+              -- STREAM_PROJECT  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- DATASOURCE_SCAN  |PARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-numeric.plan b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-numeric.plan
new file mode 100644
index 0000000..ba0dc6f
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-numeric.plan
@@ -0,0 +1,12 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- RANGE_PARTITION_MERGE_EXCHANGE [$$4(ASC)] SPLIT COUNT:3  |PARTITIONED|
+        -- STABLE_SORT [$$4(ASC)]  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+            -- ASSIGN  |PARTITIONED|
+              -- STREAM_PROJECT  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- DATASOURCE_SCAN  |PARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                      -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-string-desc.plan b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-string-desc.plan
new file mode 100644
index 0000000..3faa5ec
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-string-desc.plan
@@ -0,0 +1,9 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- RANGE_PARTITION_MERGE_EXCHANGE [$$3(DESC)] SPLIT COUNT:3  |PARTITIONED|
+        -- STABLE_SORT [$$3(DESC)]  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+            -- DATASOURCE_SCAN  |PARTITIONED|
+              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-string.plan b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-string.plan
new file mode 100644
index 0000000..e0cffaa
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/results/range-connector/sort-hint-on-closed-string.plan
@@ -0,0 +1,7 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- RANGE_PARTITION_MERGE_EXCHANGE [$$3(ASC)] SPLIT COUNT:3  |PARTITIONED|
+        -- DATASOURCE_SCAN  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+            -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.1.ddl.aql
new file mode 100644
index 0000000..eab28a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.1.ddl.aql
@@ -0,0 +1,12 @@
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.2.ddl.aql
new file mode 100644
index 0000000..8d402a7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.2.ddl.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.3.update.aql
new file mode 100644
index 0000000..2ed6ad5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.3.update.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.4.query.aql
new file mode 100644
index 0000000..833521b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_01/order-by-exception_01.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse TinySocial;
+
+for $user in dataset TwitterUsers
+/*+ range ["Ci", "Nb", "F"] */
+order by $user.screen-name
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.1.ddl.aql
new file mode 100644
index 0000000..eab28a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.1.ddl.aql
@@ -0,0 +1,12 @@
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.2.ddl.aql
new file mode 100644
index 0000000..8d402a7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.2.ddl.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.3.update.aql
new file mode 100644
index 0000000..2ed6ad5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.3.update.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.4.query.aql
new file mode 100644
index 0000000..66167c8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by-exception_02/order-by-exception_02.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse TinySocial;
+
+for $user in dataset TwitterUsers
+/*+ range ["Ci", "Nb", "F"] */
+order by $user.screen-name desc
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.1.ddl.aql
new file mode 100644
index 0000000..eab28a2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.1.ddl.aql
@@ -0,0 +1,12 @@
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64,
+        name: string,
+        followers_count: int64
+}
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.2.ddl.aql
new file mode 100644
index 0000000..8d402a7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.2.ddl.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.3.update.aql
new file mode 100644
index 0000000..2ed6ad5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.3.update.aql
@@ -0,0 +1,5 @@
+use dataverse TinySocial;
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.4.query.aql
new file mode 100644
index 0000000..afb12ef
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.4.query.aql
@@ -0,0 +1,6 @@
+use dataverse TinySocial;
+
+for $user in dataset TwitterUsers
+/*+ range ["Ci", "F", "Nb"] */
+order by $user.screen-name
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.5.query.aql
new file mode 100644
index 0000000..f9dbfe1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.5.query.aql
@@ -0,0 +1,6 @@
+use dataverse TinySocial;
+
+for $user in dataset TwitterUsers
+/*+ range ["Nb", "F", "Ci"] */
+order by $user.screen-name desc
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.6.query.aql
new file mode 100644
index 0000000..e85e13a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.6.query.aql
@@ -0,0 +1,6 @@
+use dataverse TinySocial;
+
+for $user in dataset TwitterUsers
+/*+ range [100, 150, 400] */
+order by $user.friends_count
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.7.query.aql
new file mode 100644
index 0000000..1ba71c5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/range-hints/order-by/order-by.7.query.aql
@@ -0,0 +1,6 @@
+use dataverse TinySocial;
+
+for $user in dataset TwitterUsers
+/*+ range [400, 150, 100] */
+order by $user.friends_count desc
+return $user;
diff --git a/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.4.adm b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.4.adm
new file mode 100644
index 0000000..5820838
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.4.adm
@@ -0,0 +1,5 @@
+[ { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }
+, { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }
+, { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 18, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }
+, { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.5.adm b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.5.adm
new file mode 100644
index 0000000..bbb58ab
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.5.adm
@@ -0,0 +1,5 @@
+[ { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }
+, { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 18, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }
+, { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }
+, { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.6.adm b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.6.adm
new file mode 100644
index 0000000..77b184b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.6.adm
@@ -0,0 +1,5 @@
+[ { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 18, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }
+, { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }
+, { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }
+, { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.7.adm b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.7.adm
new file mode 100644
index 0000000..9f60378
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/range-hints/order-by/order-by.7.adm
@@ -0,0 +1,5 @@
+[ { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }
+, { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }
+, { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }
+, { "screen-name": "NathanGiesen@211", "lang": "en", "friends_count": 18, "statuses_count": 473, "name": "Nathan Giesen", "followers_count": 49416 }
+ ]
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 9df6301..f97f793 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4318,6 +4318,25 @@
             </compilation-unit>
         </test-case>
     </test-group>
+    <test-group name="range-hints">
+        <test-case FilePath="range-hints">
+            <compilation-unit name="order-by">
+                <output-dir compare="Text">order-by</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="range-hints">
+            <compilation-unit name="order-by-exception_01">
+                <output-dir compare="Text">order-by</output-dir>
+                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="range-hints">
+            <compilation-unit name="order-by-exception_02">
+                <output-dir compare="Text">order-by</output-dir>
+                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+            </compilation-unit>
+        </test-case>
+    </test-group>
     <test-group name="records">
         <test-case FilePath="records">
             <compilation-unit name="closed-record-constructor_01">
@@ -5404,7 +5423,7 @@
         <test-case FilePath="tpch">
             <compilation-unit name="query-issue562">
                 <output-dir compare="Text">query-issue562</output-dir>
-        </compilation-unit>
+            </compilation-unit>
         </test-case>
         <test-case FilePath="tpch">
             <compilation-unit name="query-issue810">
@@ -6154,7 +6173,7 @@
                 <output-dir compare="Text">agg_01</output-dir>
             </compilation-unit>
         </test-case>
-       <test-case FilePath="temporal">
+        <test-case FilePath="temporal">
             <compilation-unit name="overlap_bins_gby_1">
                 <output-dir compare="Text">overlap_bins_gby_1</output-dir>
             </compilation-unit>
@@ -6310,237 +6329,237 @@
         </test-case>
     </test-group>
     <test-group name="index-leftouterjoin">
-    <test-case FilePath="index-leftouterjoin">
-      <compilation-unit name="probe-pidx-with-join-btree-sidx1">
-        <output-dir compare="Text">probe-pidx-with-join-btree-sidx1</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="index-leftouterjoin">
-      <compilation-unit name="probe-pidx-with-join-btree-sidx2">
-        <output-dir compare="Text">probe-pidx-with-join-btree-sidx2</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="index-leftouterjoin">
-      <compilation-unit name="probe-pidx-with-join-rtree-sidx1">
-        <output-dir compare="Text">probe-pidx-with-join-rtree-sidx1</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="index-leftouterjoin">
-      <compilation-unit name="probe-pidx-with-join-rtree-sidx2">
-        <output-dir compare="Text">probe-pidx-with-join-rtree-sidx2</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="index-leftouterjoin">
-      <compilation-unit name="probe-pidx-with-join-invidx-sidx1">
-        <output-dir compare="Text">probe-pidx-with-join-invidx-sidx1</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="index-leftouterjoin">
-      <compilation-unit name="probe-pidx-with-join-invidx-sidx2">
-        <output-dir compare="Text">probe-pidx-with-join-invidx-sidx2</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
-  <test-group name="distinct">
-      <test-case FilePath="distinct">
-      <compilation-unit name="query-issue443">
-        <output-dir compare="Text">query-issue443</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="distinct">
-      <compilation-unit name="query-issue443-2">
-        <output-dir compare="Text">query-issue443-2</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
-  <test-group name="tinysocial">
-    <test-case FilePath="tinysocial">
-      <compilation-unit name="tinysocial-suite">
-        <output-dir compare="Text">tinysocial-suite</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
-  <test-group name="types">
-    <test-case FilePath="types">
-      <compilation-unit name="record01">
-        <output-dir compare="Text">record01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="type_promotion_0">
-        <output-dir compare="Text">type_promotion_0</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="type_promotion_1">
-        <output-dir compare="Text">type_promotion_1</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="opentype_orderby_01">
-        <output-dir compare="Text">opentype_orderby_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_01">
-        <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_02">
-        <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_02</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_03">
-        <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_03</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_04">
-        <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_04</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_05">
-        <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_05</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_01">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_02">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_02</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_03">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_03</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_04">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_04</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_05">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_05</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_06">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_06</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_07">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_07</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_08">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_08</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_09">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_09</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_10">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_10</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_constant_11">
-        <output-dir compare="Text">promotion_closedtype_field_vs_constant_11</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_opentype_field_01">
-        <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_opentype_field_02">
-        <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_02</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_opentype_field_03">
-        <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_03</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_closedtype_field_vs_opentype_field_04">
-        <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_04</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_01">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_02">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_02</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_03">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_03</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_04">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_04</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_05">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_05</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_06">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_06</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_07">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_07</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_constant_08">
-        <output-dir compare="Text">promotion_opentype_field_vs_constant_08</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_opentype_field_01">
-        <output-dir compare="Text">promotion_opentype_field_vs_opentype_field_01</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="types">
-      <compilation-unit name="promotion_opentype_field_vs_opentype_field_02">
-        <output-dir compare="Text">promotion_opentype_field_vs_opentype_field_02</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
-  <test-group name="materialization">
-    <test-case FilePath="materialization">
-      <compilation-unit name="assign-reuse">
-        <output-dir compare="Text">assign-reuse</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
-  <test-group name="filters">
-          <test-case FilePath="filters">
+        <test-case FilePath="index-leftouterjoin">
+            <compilation-unit name="probe-pidx-with-join-btree-sidx1">
+                <output-dir compare="Text">probe-pidx-with-join-btree-sidx1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="index-leftouterjoin">
+            <compilation-unit name="probe-pidx-with-join-btree-sidx2">
+                <output-dir compare="Text">probe-pidx-with-join-btree-sidx2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="index-leftouterjoin">
+            <compilation-unit name="probe-pidx-with-join-rtree-sidx1">
+                <output-dir compare="Text">probe-pidx-with-join-rtree-sidx1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="index-leftouterjoin">
+            <compilation-unit name="probe-pidx-with-join-rtree-sidx2">
+                <output-dir compare="Text">probe-pidx-with-join-rtree-sidx2</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="index-leftouterjoin">
+            <compilation-unit name="probe-pidx-with-join-invidx-sidx1">
+                <output-dir compare="Text">probe-pidx-with-join-invidx-sidx1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="index-leftouterjoin">
+            <compilation-unit name="probe-pidx-with-join-invidx-sidx2">
+                <output-dir compare="Text">probe-pidx-with-join-invidx-sidx2</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
+    <test-group name="distinct">
+        <test-case FilePath="distinct">
+            <compilation-unit name="query-issue443">
+                <output-dir compare="Text">query-issue443</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="distinct">
+            <compilation-unit name="query-issue443-2">
+                <output-dir compare="Text">query-issue443-2</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
+    <test-group name="tinysocial">
+        <test-case FilePath="tinysocial">
+            <compilation-unit name="tinysocial-suite">
+                <output-dir compare="Text">tinysocial-suite</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
+    <test-group name="types">
+        <test-case FilePath="types">
+            <compilation-unit name="record01">
+                <output-dir compare="Text">record01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="type_promotion_0">
+                <output-dir compare="Text">type_promotion_0</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="type_promotion_1">
+                <output-dir compare="Text">type_promotion_1</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="opentype_orderby_01">
+                <output-dir compare="Text">opentype_orderby_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_01">
+                <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_02">
+                <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_03">
+                <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_04">
+                <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_04</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_closedtype_field_05">
+                <output-dir compare="Text">promotion_closedtype_field_vs_closedtype_field_05</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_01">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_02">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_03">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_04">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_04</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_05">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_05</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_06">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_06</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_07">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_07</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_08">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_08</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_09">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_09</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_10">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_10</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_constant_11">
+                <output-dir compare="Text">promotion_closedtype_field_vs_constant_11</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_opentype_field_01">
+                <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_opentype_field_02">
+                <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_opentype_field_03">
+                <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_closedtype_field_vs_opentype_field_04">
+                <output-dir compare="Text">promotion_closedtype_field_vs_opentype_field_04</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_01">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_02">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_03">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_04">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_04</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_05">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_05</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_06">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_06</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_07">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_07</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_constant_08">
+                <output-dir compare="Text">promotion_opentype_field_vs_constant_08</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_opentype_field_01">
+                <output-dir compare="Text">promotion_opentype_field_vs_opentype_field_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="types">
+            <compilation-unit name="promotion_opentype_field_vs_opentype_field_02">
+                <output-dir compare="Text">promotion_opentype_field_vs_opentype_field_02</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
+    <test-group name="materialization">
+        <test-case FilePath="materialization">
+            <compilation-unit name="assign-reuse">
+                <output-dir compare="Text">assign-reuse</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
+    <test-group name="filters">
+        <test-case FilePath="filters">
             <compilation-unit name="equality-predicate">
                 <output-dir compare="Text">equality-predicate</output-dir>
             </compilation-unit>