merged asterix_stabilization -r 860:906 to asterix_lsm_stabilization

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@914 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java
index d873c7f..b44e1b2a 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/base/RuleCollections.java
@@ -72,6 +72,7 @@
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.IntroduceGroupByForSubplanRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PullSelectOutOfEqJoin;
+import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushAssignBelowUnionAllRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushAssignDownThroughProductRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushDieUpRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushLimitDownRule;
@@ -195,10 +196,12 @@
     }
 
     public final static List<IAlgebraicRewriteRule> buildPlanCleanupRuleCollection() {
-        List<IAlgebraicRewriteRule> planCleanupRules = new LinkedList<IAlgebraicRewriteRule>();
+        List<IAlgebraicRewriteRule> planCleanupRules = new LinkedList<IAlgebraicRewriteRule>();        
+        planCleanupRules.add(new PushAssignBelowUnionAllRule());
         planCleanupRules.add(new ExtractCommonExpressionsRule());
         planCleanupRules.add(new PushProjectDownRule());
         planCleanupRules.add(new PushSelectDownRule());
+        planCleanupRules.add(new RemoveUnusedAssignAndAggregateRule());
         return planCleanupRules;
     }
 
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java
index 3279c0d..1ede912 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java
@@ -201,7 +201,14 @@
             IOptimizableFuncExpr optFuncExpr = matchedFuncExprs.get(exprIndex);
             int keyPos = indexOf(optFuncExpr.getFieldName(0), chosenIndex.getKeyFieldNames());
             if (keyPos < 0) {
-                throw new InternalError();
+                if (optFuncExpr.getNumLogicalVars() > 1) {
+                    // If we are optimizing a join, the matching field may be the second field name.
+                    keyPos = indexOf(optFuncExpr.getFieldName(1), chosenIndex.getKeyFieldNames());
+                }                
+            }
+            if (keyPos < 0) {
+                throw new AlgebricksException(
+                        "Could not match optimizable function expression to any index field name.");
             }
             ILogicalExpression searchKeyExpr = AccessMethodUtils.createSearchKeyExpr(optFuncExpr, indexSubTree,
                     probeSubTree);
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
index ae48e17..7028e23 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
@@ -464,7 +464,7 @@
         }
 
         if (f == null) {
-            throw new AsterixException(" Unknown function " + signature);
+            throw new AsterixException(" Unknown function " + signature.getName() + "@" + signature.getArity());
         }
 
         // Put hints into function call expr.
@@ -512,9 +512,9 @@
             fi = builtinAquafi;
         } else {
             fi = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, functionName, arity);
-            FunctionIdentifier builtinAsterixFi = AsterixBuiltinFunctions.getBuiltinFunctionIdentifier(fi);
-            if (builtinAsterixFi != null) {
-                fi = builtinAsterixFi;
+            afi = AsterixBuiltinFunctions.lookupFunction(fi);
+            if (afi == null) {
+                return null;
             }
         }
         if (AsterixBuiltinFunctions.isBuiltinAggregateFunction(fi)) {
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/TypeTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/TypeTranslator.java
index 83572e2..4047d9a 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/TypeTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/TypeTranslator.java
@@ -136,7 +136,6 @@
 
         for (TypeSignature typeSignature : incompleteTopLevelTypeReferences.keySet()) {
             IAType t;// = typeMap.get(trefName);
-            System.out.println("METADATA MGR : " + MetadataManager.INSTANCE);
             Datatype dt = MetadataManager.INSTANCE.getDatatype(mdTxnCtx, typeSignature.getNamespace(),
                     typeSignature.getName());
             if (dt == null) {
@@ -150,7 +149,6 @@
         // solve remaining field type references
         for (String trefName : incompleteFieldTypes.keySet()) {
             IAType t;// = typeMap.get(trefName);
-            System.out.println("METADATA MGR : " + MetadataManager.INSTANCE);
             Datatype dt = MetadataManager.INSTANCE.getDatatype(mdTxnCtx, typeDataverse, trefName);
             if (dt == null) {
                 throw new AlgebricksException("Could not resolve type " + trefName);
diff --git a/asterix-app/data/spatial/spatialData.json b/asterix-app/data/spatial/spatialData.json
index 6f094ee..e2dd151 100644
--- a/asterix-app/data/spatial/spatialData.json
+++ b/asterix-app/data/spatial/spatialData.json
@@ -1,19 +1,19 @@
-{"id": 1, "point": point("4.1,7.0"), "kwds": "sign ahead", "line1": line("4.0,7.0 9.0,7.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.2,7.0")}
-{"id": 2, "point": point("40.2152,-75.0449"), "kwds": "factory hosedan", "line1": line("-4.0,2.0 2.0,2.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 3, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("3.0,0.0 0.0,4.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 4, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("4.0,7.0 2.0,17.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0 2.0,1.0 1.0,0.0"), "poly2": polygon("2.0,1.0 2.0,2.0 3.0,2.0 3.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 5, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("4.0,7.0 2.0,17.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("100.0,100.0 100.0,400.0 300.0,400.0 300.0,100.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 6, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("0.0,5.0 1.0,7.0"), "line2": line("4.0,7.0 2.0,-17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("3.1,1.0 2.9,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 7, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("0.0,5.0 4.0,7.1"), "line2": line("4.0,7.0 2.0,-17.0"), "poly1": polygon("-5.0,-2.0 -4.0,-1.0 -3.0,-1.0 -2.0,-2.0 -4.0,-4.0 -5.0,-3.0"), "poly2": polygon("3.0,1.0 3.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("3.0,6.0 5.0,7.0")}
-{"id": 8, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("4.0,7.0 2.0,17.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("-5.0,-2.0 -4.0,-1.0 -3.0,-1.0 -2.0,-2.0 -4.0,-4.0 -5.0,-3.0"), "poly2": polygon("-3.0,-3.0 -1.0,-3.0 -3.0,-5.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 9, "point": point("5.0,1.0"), "kwds": "sign ahead", "line1": line("5.0,1.0 5.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 10, "point": point("2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("6.01,1.0 6.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 11, "point": point("4.9,0.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("4.9,0.1 4.9,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 12, "point": point("6.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("4.0,1.0 4.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 13, "point": point("5.0,5.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("6.0,1.0 6.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 14, "point": point("5.1,5.1"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 5.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 15, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.1,1.0 5.1,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 16, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 17, "point": point("4.1,7.0"), "kwds": "sign ahead", "line1": line("4.0,7.0 9.0,7.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("0.0,6.0 0.0,0.0 3.0,0.0 4.0,1.0 6.0,1.0 8.0,0.0 12.0,0.0 13.0,2.0 8.0,2.0 8.0,4.0 11.0,4.0 11.0,6.0 6.0,6.0 4.0,3.0 2.0,6.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 18, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 7.0,1.0 7.0,4.0 6.0,2.0 5.0,4.0"), "poly2": polygon("6.0,3.0 7.0,5.0 6.0,7.0 5.0,5.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
-{"id": 19, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 7.0,1.0 7.0,4.0 6.0,2.0 5.0,4.0"), "poly2": polygon("6.0,1.0 7.0,5.0 6.0,7.0 5.0,5.0"), "rec": rectangle("0.0,0.0 4.0,4.0")}
\ No newline at end of file
+{"id": 1, "point": point("4.1,7.0"), "kwds": "sign ahead", "line1": line("4.0,7.0 9.0,7.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.2,7.0"), "circle" : circle("1.0,1.0 10.0")}
+{"id": 2, "point": point("40.2152,-75.0449"), "kwds": "factory hosedan", "line1": line("-4.0,2.0 2.0,2.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("2.0,3.0 2.0")}
+{"id": 3, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("3.0,0.0 0.0,4.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("5.5,1.0 10.0")}
+{"id": 4, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("4.0,7.0 2.0,17.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0 2.0,1.0 1.0,0.0"), "poly2": polygon("2.0,1.0 2.0,2.0 3.0,2.0 3.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("77.0,4.0 30.0")}
+{"id": 5, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("4.0,7.0 2.0,17.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("100.0,100.0 100.0,400.0 300.0,400.0 300.0,100.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("88.0,1.0 10.0")}
+{"id": 6, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("0.0,5.0 1.0,7.0"), "line2": line("4.0,7.0 2.0,-17.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("3.1,1.0 2.9,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("1.0,1.0 10.0")}
+{"id": 7, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("0.0,5.0 4.0,7.1"), "line2": line("4.0,7.0 2.0,-17.0"), "poly1": polygon("-5.0,-2.0 -4.0,-1.0 -3.0,-1.0 -2.0,-2.0 -4.0,-4.0 -5.0,-3.0"), "poly2": polygon("3.0,1.0 3.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("3.0,6.0 5.0,7.0"), "circle" : circle("13.0,75.0 1.0")}
+{"id": 8, "point": point("43.5083,-79.3007"), "kwds": "enterprisecamp torcamp", "line1": line("4.0,7.0 2.0,17.0"), "line2": line("4.0,7.0 2.0,17.0"), "poly1": polygon("-5.0,-2.0 -4.0,-1.0 -3.0,-1.0 -2.0,-2.0 -4.0,-4.0 -5.0,-3.0"), "poly2": polygon("-3.0,-3.0 -1.0,-3.0 -3.0,-5.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("76.0,87.0 50.0")}
+{"id": 9, "point": point("5.0,1.0"), "kwds": "sign ahead", "line1": line("5.0,1.0 5.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("1.0,1.0 1.0,4.0 3.0,4.0 3.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("11.0,14.0 15.0")}
+{"id": 10, "point": point("2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("6.01,1.0 6.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("1.0,76.0 17.0")}
+{"id": 11, "point": point("4.9,0.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("4.9,0.1 4.9,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("22.0,35.0 144.0")}
+{"id": 12, "point": point("6.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("4.0,1.0 4.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("1.0,23.0 12.0")}
+{"id": 13, "point": point("5.0,5.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("6.0,1.0 6.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("30.0,11.0 11.0")}
+{"id": 14, "point": point("5.1,5.1"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 5.0,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("1.0,66.0 17.0")}
+{"id": 15, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.1,1.0 5.1,4.0 12.0,4.0 12.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("12.0,87.0 10.0")}
+{"id": 16, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("1.0,35.0 10.0")}
+{"id": 17, "point": point("4.1,7.0"), "kwds": "sign ahead", "line1": line("4.0,7.0 9.0,7.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("0.0,6.0 0.0,0.0 3.0,0.0 4.0,1.0 6.0,1.0 8.0,0.0 12.0,0.0 13.0,2.0 8.0,2.0 8.0,4.0 11.0,4.0 11.0,6.0 6.0,6.0 4.0,3.0 2.0,6.0"), "poly2": polygon("5.0,1.0 5.0,4.0 7.0,4.0 7.0,1.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("1.0,51.0 10.0")}
+{"id": 18, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 7.0,1.0 7.0,4.0 6.0,2.0 5.0,4.0"), "poly2": polygon("6.0,3.0 7.0,5.0 6.0,7.0 5.0,5.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("43.0,45.0 12.0")}
+{"id": 19, "point": point("-2.0,3.0"), "kwds": "sign ahead", "line1": line("1.0,2.0 3.0,4.0"), "line2": line("5.0,8.0 5.0,1.0"), "poly1": polygon("5.0,1.0 7.0,1.0 7.0,4.0 6.0,2.0 5.0,4.0"), "poly2": polygon("6.0,1.0 7.0,5.0 6.0,7.0 5.0,5.0"), "rec": rectangle("0.0,0.0 4.0,4.0"), "circle" : circle("65.0,2.0 13.0")}
\ No newline at end of file
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
index 08a60b4..2649e2c 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
@@ -269,6 +269,7 @@
 
         OptimizationConfUtil.getPhysicalOptimizationConfig().setFrameSize(frameSize);
         builder.setPhysicalOptimizationConfig(OptimizationConfUtil.getPhysicalOptimizationConfig());
+        
         ICompiler compiler = compilerFactory.createCompiler(plan, queryMetadataProvider, t.getVarCounter());
         if (pc.isOptimize()) {
             compiler.optimize();
@@ -305,13 +306,6 @@
             }
         }
 
-        if (!pc.isGenerateJobSpec()) {
-            // Job spec not requested. Consider transaction against metadata
-            // committed.
-            MetadataManager.INSTANCE.commitTransaction(queryMetadataProvider.getMetadataTxnContext());
-            return null;
-        }
-
         AlgebricksPartitionConstraint clusterLocs = queryMetadataProvider.getClusterLocations();
         builder.setBinaryBooleanInspectorFactory(format.getBinaryBooleanInspectorFactory());
         builder.setBinaryIntegerInspectorFactory(format.getBinaryIntegerInspectorFactory());
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 3175f65..b363d1c 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
@@ -828,5 +828,4 @@
         }
         return format;
     }
-
-}
\ No newline at end of file
+}
diff --git a/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index-open.aql b/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index-open.aql
index 192b189..14416c8 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index-open.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index-open.aql
@@ -10,7 +10,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create nodegroup group1  if not exists on nc1, nc2;
diff --git a/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index.aql b/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index.aql
index d525458..c8525c1 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/rtree-secondary-index.aql
@@ -10,7 +10,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create nodegroup group1  if not exists on nc1, nc2;
diff --git a/asterix-app/src/test/resources/optimizerts/queries/scan-delete-rtree-secondary-index.aql b/asterix-app/src/test/resources/optimizerts/queries/scan-delete-rtree-secondary-index.aql
index 5f1e8d3..4d5de58 100644
--- a/asterix-app/src/test/resources/optimizerts/queries/scan-delete-rtree-secondary-index.aql
+++ b/asterix-app/src/test/resources/optimizerts/queries/scan-delete-rtree-secondary-index.aql
@@ -10,7 +10,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create nodegroup group1  if not exists on nc1, nc2;
diff --git a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_01.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-edit-distance-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_02.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-edit-distance-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_03.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-edit-distance-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan
index e089606..b498093 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance-check_04.plan
@@ -1,13 +1,13 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
+                  -- ASSIGN  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                       -- BTREE_SEARCH  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |LOCAL|
@@ -24,21 +24,24 @@
                                               -- DATASOURCE_SCAN  |PARTITIONED|
                                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                   -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- STREAM_SELECT  |UNPARTITIONED|
                   -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                      -- NESTED_LOOP  |PARTITIONED|
+                        -- BROADCAST_EXCHANGE  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                          -- STREAM_SELECT  |LOCAL|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- SPLIT  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                                  -- ASSIGN  |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/inverted-index-join/ngram-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_01.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_02.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_03.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-edit-distance_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan
index e089606..b498093 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-edit-distance_04.plan
@@ -1,13 +1,13 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
+                  -- ASSIGN  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                       -- BTREE_SEARCH  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |LOCAL|
@@ -24,21 +24,24 @@
                                               -- DATASOURCE_SCAN  |PARTITIONED|
                                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                   -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- STREAM_SELECT  |UNPARTITIONED|
                   -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                      -- NESTED_LOOP  |PARTITIONED|
+                        -- BROADCAST_EXCHANGE  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                          -- STREAM_SELECT  |LOCAL|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- SPLIT  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                                  -- ASSIGN  |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/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan
index 3b8e18b..b689d17 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_01.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$21(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$21(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan
index 3b8e18b..b689d17 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_02.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$21(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$21(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan
index 3b8e18b..b689d17 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/ngram-fuzzyeq-edit-distance_03.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$21(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$21(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance-check_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_01.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance-check_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_02.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance-check_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_03.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance-check_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan
index e089606..b498093 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance-check_04.plan
@@ -1,13 +1,13 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
+                  -- ASSIGN  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                       -- BTREE_SEARCH  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |LOCAL|
@@ -24,21 +24,24 @@
                                               -- DATASOURCE_SCAN  |PARTITIONED|
                                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                   -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- STREAM_SELECT  |UNPARTITIONED|
                   -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                      -- NESTED_LOOP  |PARTITIONED|
+                        -- BROADCAST_EXCHANGE  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                          -- STREAM_SELECT  |LOCAL|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- SPLIT  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                                  -- ASSIGN  |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/inverted-index-join/olist-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_01.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_02.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan
index cdd1eb7..a271a95 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_03.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$22(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$22(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-edit-distance_04.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan
index e089606..b498093 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-edit-distance_04.plan
@@ -1,13 +1,13 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
+                  -- ASSIGN  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                       -- BTREE_SEARCH  |PARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |LOCAL|
@@ -24,21 +24,24 @@
                                               -- DATASOURCE_SCAN  |PARTITIONED|
                                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                   -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- STREAM_SELECT  |UNPARTITIONED|
                   -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                      -- NESTED_LOOP  |PARTITIONED|
+                        -- BROADCAST_EXCHANGE  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                          -- STREAM_SELECT  |LOCAL|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- SPLIT  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                                  -- ASSIGN  |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/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan
index 3b8e18b..b689d17 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_01.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$21(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$21(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan
index 3b8e18b..b689d17 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_02.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$21(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$21(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan
index 3b8e18b..b689d17 100644
--- a/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/inverted-index-join/olist-fuzzyeq-edit-distance_03.plan
@@ -1,44 +1,46 @@
 -- SINK_WRITE  |PARTITIONED|
   -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
     -- STREAM_PROJECT  |PARTITIONED|
-      -- ASSIGN  |PARTITIONED|
-        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-          -- UNION_ALL  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-              -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+        -- UNION_ALL  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
                 -- STREAM_SELECT  |LOCAL|
-                  -- ASSIGN  |PARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- BTREE_SEARCH  |PARTITIONED|
-                        -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                          -- STABLE_SORT [$$21(ASC)]  |LOCAL|
-                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- INVERTED_INDEX_SEARCH  |PARTITIONED|
-                                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  -- STREAM_SELECT  |LOCAL|
-                                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                      -- SPLIT  |PARTITIONED|
-                                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                          -- ASSIGN  |PARTITIONED|
-                                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                              -- DATASOURCE_SCAN  |PARTITIONED|
-                                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                                  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
-            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-              -- NESTED_LOOP  |PARTITIONED|
-                -- BROADCAST_EXCHANGE  |PARTITIONED|
-                  -- ASSIGN  |UNPARTITIONED|
-                    -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                      -- DATASOURCE_SCAN  |UNPARTITIONED|
+                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                    -- BTREE_SEARCH  |PARTITIONED|
+                      -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                        -- STABLE_SORT [$$21(ASC)]  |LOCAL|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- INVERTED_INDEX_SEARCH  |PARTITIONED|
+                              -- BROADCAST_EXCHANGE  |PARTITIONED|
+                                -- STREAM_SELECT  |LOCAL|
+                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                    -- SPLIT  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- ASSIGN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+          -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+            -- STREAM_PROJECT  |UNPARTITIONED|
+              -- ASSIGN  |PARTITIONED|
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- NESTED_LOOP  |PARTITIONED|
+                    -- BROADCAST_EXCHANGE  |PARTITIONED|
+                      -- ASSIGN  |UNPARTITIONED|
                         -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
-                          -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
-                -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                  -- STREAM_SELECT  |LOCAL|
-                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                      -- SPLIT  |PARTITIONED|
+                          -- DATASOURCE_SCAN  |UNPARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |LOCAL|
+                      -- STREAM_SELECT  |LOCAL|
                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                          -- ASSIGN  |PARTITIONED|
+                          -- SPLIT  |PARTITIONED|
                             -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                              -- DATASOURCE_SCAN  |PARTITIONED|
+                              -- ASSIGN  |PARTITIONED|
                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
-                                  -- EMPTY_TUPLE_SOURCE  |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/scan-delete-rtree-secondary-index.plan b/asterix-app/src/test/resources/optimizerts/results/scan-delete-rtree-secondary-index.plan
index 6ce02fa..4fa0658 100644
--- a/asterix-app/src/test/resources/optimizerts/results/scan-delete-rtree-secondary-index.plan
+++ b/asterix-app/src/test/resources/optimizerts/results/scan-delete-rtree-secondary-index.plan
@@ -2,15 +2,15 @@
   -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
     -- INDEX_INSERT_DELETE  |UNPARTITIONED|
       -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-        -- STABLE_SORT [$$27(ASC), $$28(ASC), $$29(ASC), $$30(ASC)]  |LOCAL|
+        -- STABLE_SORT [$$29(ASC), $$30(ASC), $$31(ASC), $$32(ASC)]  |LOCAL|
           -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
             -- ASSIGN  |UNPARTITIONED|
               -- ASSIGN  |UNPARTITIONED|
                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                   -- INSERT_DELETE  |PARTITIONED|
                     -- ONE_TO_ONE_EXCHANGE  |LOCAL|
-                      -- STABLE_SORT [$$13(ASC)]  |LOCAL|
-                        -- HASH_PARTITION_EXCHANGE [$$13]  |PARTITIONED|
+                      -- STABLE_SORT [$$14(ASC)]  |LOCAL|
+                        -- HASH_PARTITION_EXCHANGE [$$14]  |PARTITIONED|
                           -- ASSIGN  |PARTITIONED|
                             -- STREAM_PROJECT  |PARTITIONED|
                               -- ASSIGN  |PARTITIONED|
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql
index 6201ca2..4e2ca6c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index.aql
@@ -10,7 +10,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create dataset MyData(MyRecord)
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql
index 236b4a9..f1bc29d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index.aql
@@ -10,7 +10,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create type MyMiniRecord as closed {
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-join/rtree-spatial-intersect-point.aql b/asterix-app/src/test/resources/runtimets/queries/index-join/rtree-spatial-intersect-point.aql
index efee6cf..ab79189 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-join/rtree-spatial-intersect-point.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-join/rtree-spatial-intersect-point.aql
@@ -17,7 +17,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create dataset MyData1(MyRecord) partitioned by key id;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index.aql
index 7ff775c..c1e1890 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index.aql
@@ -10,7 +10,8 @@
   line2: line,
   poly1: polygon,
   poly2: polygon,
-  rec: rectangle
+  rec: rectangle,
+  circle: circle
 }
 
 create dataset MyData(MyRecord)
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index.aql
new file mode 100644
index 0000000..e755aa9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/create-rtree-index.aql
@@ -0,0 +1,34 @@
+/*
+ * Description    : Create r-tree indexes for all spatial data types.
+ * Success        : Yes
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type SpatialType as open {
+  id: int32,
+  point: point,
+  line1: line,
+  poly1: polygon,
+  rec: rectangle,
+  circle: circle
+}
+
+create dataset MyData(SpatialType) partitioned by key id;
+create index rtree_index1 on MyData(point) type rtree;
+create index rtree_index2 on MyData(line1) type rtree;
+create index rtree_index3 on MyData(poly1) type rtree;
+create index rtree_index5 on MyData(rec) type rtree;
+create index rtree_index4 on MyData(circle) type rtree;
+
+write output to nc1:"rttest/spatial_create-rtree-index.adm";
+
+load dataset MyData 
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
+
+for $a in dataset('MyData')
+return $a.id
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/f01.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/f01.aql
new file mode 100644
index 0000000..7f87de7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/f01.aql
@@ -0,0 +1,14 @@
+/*
+ * Description  : Invoke a built-in function with incorrect number of arguments
+ * Expected Res : Failure
+ * Date         : Nov 13th 2012
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+
+write output to nc1:"rttest/user-defined-functions_f01.adm";
+
+let $c1 := int8()
+return $c1
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf01.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf01.aql
similarity index 83%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf01.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf01.aql
index b4c3e11..35718b1 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf01.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf01.aql
@@ -8,7 +8,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf01.adm";
+write output to nc1:"rttest/user-defined-functions_udf01.adm";
 
 create function test.echo($list){
 $list
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf02.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf02.aql
similarity index 83%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf02.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf02.aql
index 7e816c5..2605f7a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf02.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf02.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf02.adm";
+write output to nc1:"rttest/user-defined-functions_udf02.adm";
 
 create function test.getFirst($list){
 $list[0]
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf03.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf03.aql
similarity index 78%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf03.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf03.aql
index c479b1b..747f29d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf03.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf03.aql
@@ -5,12 +5,12 @@
  * Ignored      : Not part of test build due to Issue 200
  */
 
-// This test is returning NPE...
+// This test is returning NPE... Issue 200 
 
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf03.adm";
+write output to nc1:"rttest/user-defined-functions_udf03.adm";
 
 create function test.echo($list){
 $list
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf04.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf04.aql
similarity index 86%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf04.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf04.aql
index 088b97e..bd6544f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf04.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf04.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf04.adm";
+write output to nc1:"rttest/user-defined-functions_udf04.adm";
 
 create function test.echo($list){
 $list
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf05.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf05.aql
similarity index 81%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf05.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf05.aql
index 1e393f3..2429f1c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf05.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf05.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf05.adm";
+write output to nc1:"rttest/user-defined-functions_udf05.adm";
 
 create function test.echo($a){
 $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf06.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf06.aql
similarity index 79%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf06.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf06.aql
index 9e736bd..3301d5c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf06.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf06.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf06.adm";
+write output to nc1:"rttest/user-defined-functions_udf06.adm";
 
 create function test.echo($a){
 $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf07.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf07.aql
similarity index 79%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf07.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf07.aql
index 1e74e96..0280e92 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf07.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf07.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf07.adm";
+write output to nc1:"rttest/user-defined-functions_udf07.adm";
 
 create function test.echo($a){
 $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf08.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf08.aql
similarity index 80%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf08.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf08.aql
index 42e6f22..5dfb9a2 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf08.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf08.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf08.adm";
+write output to nc1:"rttest/user-defined-functions_udf08.adm";
 
 create function test.echo($a){
 $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf09.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf09.aql
similarity index 91%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf09.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf09.aql
index 33e8e52..b16e2dd 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf09.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf09.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf09.adm";
+write output to nc1:"rttest/user-defined-functions_udf09.adm";
 
 create type test.TestType as open {
 id : int32
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf10.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf10.aql
similarity index 84%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf10.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf10.aql
index 739bc05..d0da4e1 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf10.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf10.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf10.adm";
+write output to nc1:"rttest/user-defined-functions_udf10.adm";
 
 create function test.echo($uolist){
 $uolist
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf11.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf11.aql
similarity index 81%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf11.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf11.aql
index 1395cfa..b842c93 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf11.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf11.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf11.adm";
+write output to nc1:"rttest/user-defined-functions_udf11.adm";
 
 create function test.OList(){
 [1,2,3,4,5,6,7,8,9,10]
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf12.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf12.aql
similarity index 78%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf12.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf12.aql
index ad710eb..e3f8122 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf12.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf12.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf12.adm";
+write output to nc1:"rttest/user-defined-functions_udf12.adm";
 
 create function test.foo($a,$b) {
 $a+$b
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf13.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf13.aql
similarity index 79%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf13.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf13.aql
index c48acf7..533def7 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf13.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf13.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf13.adm";
+write output to nc1:"rttest/user-defined-functions_udf13.adm";
 
 create function test.foo($a,$b) {
 $a - $b
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf14.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf14.aql
similarity index 79%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf14.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf14.aql
index 66d362f..fc3447d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf14.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf14.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf14.adm";
+write output to nc1:"rttest/user-defined-functions_udf14.adm";
 
 create function test.foo($a,$b) {
 $a*$b
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf15.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf15.aql
similarity index 81%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf15.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf15.aql
index 55cc519..4b4992a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf15.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf15.aql
@@ -6,12 +6,12 @@
  * Ignored      : Not part of current tests because of Issue 200
  */
 
-// this test resturns NPE
+// this test resturns NPE:Issue 166
 
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf15.adm";
+write output to nc1:"rttest/user-defined-functions_udf15.adm";
 
 create function test.OList2(){
 [[1,2,3,4,5,6,7,8,9,10],["a","b","c","d","e","f","g","h","y"]]
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf16.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf16.aql
similarity index 84%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf16.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf16.aql
index 5b7d4ef..e9f0742 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf16.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf16.aql
@@ -8,7 +8,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf16.adm";
+write output to nc1:"rttest/user-defined-functions_udf16.adm";
 
 create function test.fn02(){
 "Welcome to the world of Asterix"
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf17.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17.aql
similarity index 86%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf17.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17.aql
index 89fb567..b98d123 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf17.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf17.aql
@@ -8,7 +8,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf17.adm";
+write output to nc1:"rttest/user-defined-functions_udf17.adm";
 
 create function test.parent(){
 test.child()
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf18.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf18.aql
similarity index 81%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf18.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf18.aql
index 14791b7..aa6a57b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf18.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf18.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf18.adm";
+write output to nc1:"rttest/user-defined-functions_udf18.adm";
 
 create function test.fn06(){
 false
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf19.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf19.aql
similarity index 85%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf19.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf19.aql
index bf024c7..87c39a5 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf19.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf19.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf19.adm";
+write output to nc1:"rttest/user-defined-functions_udf19.adm";
 
 create function test.pie(){
 3.14
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf20.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf20.aql
similarity index 86%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf20.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf20.aql
index dfc9610..e0a16a1 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf20.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf20.aql
@@ -8,7 +8,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf20.adm";
+write output to nc1:"rttest/user-defined-functions_udf20.adm";
 
 create function test.pie(){
 3.14
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf21.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf21.aql
similarity index 83%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf21.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf21.aql
index 4212b04..7e943c3 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf21.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf21.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf21.adm";
+write output to nc1:"rttest/user-defined-functions_udf21.adm";
 
 create function test.isOdd($b){
 $b%2 != 0
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf22.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf22.aql
similarity index 84%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf22.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf22.aql
index a34e129..83e19e6 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf22.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf22.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf22.adm";
+write output to nc1:"rttest/user-defined-functions_udf22.adm";
 
 create function test.getFullName($fname,$lname){
 string-concat([$fname,$lname])
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf23.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf23.aql
similarity index 81%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf23.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf23.aql
index 1c5ca12..a2d8ec5 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf23.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf23.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf23.adm";
+write output to nc1:"rttest/user-defined-functions_udf23.adm";
 
 create function test.numRows(){
 6
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf24.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf24.aql
similarity index 74%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf24.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf24.aql
index 9de03b7..eef906d 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf24.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf24.aql
@@ -5,12 +5,12 @@
  * Ignored      : Not part of current test build because of Issue 201
  */
 
-// Returns java.lang.ClassCastException
+// Returns java.lang.ClassCastException : Issue 195
 
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf24.adm";
+write output to nc1:"rttest/user-defined-functions_udf24.adm";
 
 create function test.myRangeFn($n)
 {
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf25.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf25.aql
similarity index 85%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf25.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf25.aql
index 5b70889..fefc07e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf25.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf25.aql
@@ -9,7 +9,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf25.adm";
+write output to nc1:"rttest/user-defined-functions_udf25.adm";
 
 create function test.computeBonus($pbcRating,$salary)
 {
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf26.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26.aql
similarity index 80%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf26.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26.aql
index 9f460bc..95420b7 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf26.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf26.aql
@@ -7,7 +7,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf26.adm";
+write output to nc1:"rttest/user-defined-functions_udf26.adm";
 
 create function test.needs_f1($x){
  $x + f1()
diff --git a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf27.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27.aql
similarity index 85%
rename from asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf27.aql
rename to asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27.aql
index c50b3dc..b9db17f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/cross-dataverse/udf27.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf27.aql
@@ -10,7 +10,7 @@
 drop dataverse test if exists;
 create dataverse test;
 
-write output to nc1:"rttest/cross-dataverse_udf27.adm";
+write output to nc1:"rttest/user-defined-functions_udf27.adm";
 
 create function test.f1(){
 100
diff --git a/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index.adm b/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index.adm
new file mode 100644
index 0000000..1778736
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/spatial/create-rtree-index.adm
@@ -0,0 +1,19 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf01.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf01.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf01.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf01.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf02.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf02.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf02.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf02.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf03.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf03.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf03.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf03.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf04.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf04.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf04.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf04.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf05.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf05.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf05.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf05.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf06.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf06.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf06.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf06.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf07.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf07.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf07.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf07.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf08.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf08.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf08.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf08.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf09.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf09.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf09.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf09.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf10.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf10.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf10.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf10.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf11.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf11.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf11.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf11.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf12.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf12.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf12.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf12.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf13.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf13.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf13.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf13.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf14.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf14.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf14.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf14.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf16.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf16.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf16.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf16.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf17.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf17.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf17.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf17.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf18.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf18.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf18.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf18.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf19.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf19.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf19.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf19.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf20.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf20.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf20.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf20.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf21.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf21.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf21.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf21.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf22.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf22.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf22.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf22.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf23.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf23.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf23.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf23.adm
diff --git a/asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf27.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf27.adm
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/cross-dataverse/udf27.adm
rename to asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf27.adm
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 4739a85..af49e84 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1384,8 +1384,13 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-1_2">
-        <output-file compare="Text">dblp-1_2.adm</output-file>
+      <compilation-unit name="dblp-1_2.1.1">
+        <output-file compare="Text">dblp-1_2.1.1.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="fuzzyjoin">
+      <compilation-unit name="dblp-1_2.1">
+        <output-file compare="Text">dblp-1_2.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
@@ -1394,17 +1399,10 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-1_2">
-        <output-file compare="Text">dblp-1_2.adm</output-file>
+      <compilation-unit name="dblp-2.1_5.3.1">
+        <output-file compare="Text">dblp-2.1_5.3.1.adm</output-file>
       </compilation-unit>
     </test-case>
-   <!--
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-2">
-        <output-file compare="Text">dblp-2.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    -->
     <test-case FilePath="fuzzyjoin">
       <compilation-unit name="dblp-2_1">
         <output-file compare="Text">dblp-2_1.adm</output-file>
@@ -1416,6 +1414,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
+      <compilation-unit name="dblp-2.2">
+        <output-file compare="Text">dblp-2.2.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="fuzzyjoin">
       <compilation-unit name="dblp-2_3">
         <output-file compare="Text">dblp-2_3.adm</output-file>
       </compilation-unit>
@@ -1426,8 +1429,23 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-2_5">
-        <output-file compare="Text">dblp-2_5.adm</output-file>
+      <compilation-unit name="dblp-2_5.1">
+        <output-file compare="Text">dblp-2_5.1.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="fuzzyjoin">
+      <compilation-unit name="dblp-2_5.2">
+        <output-file compare="Text">dblp-2_5.2.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="fuzzyjoin">
+      <compilation-unit name="dblp-2_5.3.1">
+        <output-file compare="Text">dblp-2_5.3.1.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="fuzzyjoin">
+      <compilation-unit name="dblp-2_5.3">
+        <output-file compare="Text">dblp-2_5.3.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
@@ -1436,28 +1454,13 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-2_5">
-        <output-file compare="Text">dblp-2_5.adm</output-file>
+      <compilation-unit name="dblp-3_1.1">
+        <output-file compare="Text">dblp-3_1.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-2_5">
-        <output-file compare="Text">dblp-2_5.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-2_5">
-        <output-file compare="Text">dblp-2_5.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-3_1">
-        <output-file compare="Text">dblp-3_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-3_1">
-        <output-file compare="Text">dblp-3_1.adm</output-file>
+      <compilation-unit name="dblp-3_1.2">
+        <output-file compare="Text">dblp-3_1.2.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
@@ -1491,23 +1494,23 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-2_5">
-        <output-file compare="Text">dblp-csx-2_5.adm</output-file>
+      <compilation-unit name="dblp-csx-2_5.1">
+        <output-file compare="Text">dblp-csx-2_5.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-2_5">
-        <output-file compare="Text">dblp-csx-2_5.adm</output-file>
+      <compilation-unit name="dblp-csx-2_5.2">
+        <output-file compare="Text">dblp-csx-2_5.2.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-2_5">
-        <output-file compare="Text">dblp-csx-2_5.adm</output-file>
+      <compilation-unit name="dblp-csx-2_5.3.1">
+        <output-file compare="Text">dblp-csx-2_5.3.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-2_5">
-        <output-file compare="Text">dblp-csx-2_5.adm</output-file>
+      <compilation-unit name="dblp-csx-2_5.3">
+        <output-file compare="Text">dblp-csx-2_5.3.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
@@ -1536,33 +1539,33 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-3_5">
-        <output-file compare="Text">dblp-csx-3_5.adm</output-file>
+      <compilation-unit name="dblp-csx-3_5.1">
+        <output-file compare="Text">dblp-csx-3_5.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-3_5">
-        <output-file compare="Text">dblp-csx-3_5.adm</output-file>
+      <compilation-unit name="dblp-csx-3_5.2">
+        <output-file compare="Text">dblp-csx-3_5.2.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-3_5">
-        <output-file compare="Text">dblp-csx-3_5.adm</output-file>
+      <compilation-unit name="dblp-csx-3_5.3.1">
+        <output-file compare="Text">dblp-csx-3_5.3.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-3_5">
-        <output-file compare="Text">dblp-csx-3_5.adm</output-file>
+      <compilation-unit name="dblp-csx-3_5.3">
+        <output-file compare="Text">dblp-csx-3_5.3.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-3_5">
-        <output-file compare="Text">dblp-csx-3_5.adm</output-file>
+      <compilation-unit name="dblp-csx-3_5.4.1">
+        <output-file compare="Text">dblp-csx-3_5.4.1.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="dblp-csx-3_5">
-        <output-file compare="Text">dblp-csx-3_5.adm</output-file>
+      <compilation-unit name="dblp-csx-3_5.4">
+        <output-file compare="Text">dblp-csx-3_5.4.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="fuzzyjoin">
@@ -1602,113 +1605,6 @@
       </compilation-unit>
     </test-case>
     -->
-    <!--
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="events-users-aqlplus_1">
-        <output-file compare="Text">events-users-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    -->
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-int-aqlplus_1">
-        <output-file compare="Text">user-int-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-int-aqlplus_2">
-        <output-file compare="Text">user-int-aqlplus_2.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-int-aqlplus_3">
-        <output-file compare="Text">user-int-aqlplus_3.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-lot-aqlplus_1">
-        <output-file compare="Text">user-lot-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-lot-aqlplus_1">
-        <output-file compare="Text">user-lot-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-lot-aqlplus_2">
-        <output-file compare="Text">user-lot-aqlplus_2.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-lot-aqlplus_3">
-        <output-file compare="Text">user-lot-aqlplus_3.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-int-3_1">
-        <output-file compare="Text">user-vis-int-3_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-int-aqlplus_1">
-        <output-file compare="Text">user-vis-int-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-int-aqlplus_2">
-        <output-file compare="Text">user-vis-int-aqlplus_2.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-int-aqlplus_3">
-        <output-file compare="Text">user-vis-int-aqlplus_3.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-int-vis-user-lot-aqlplus_1">
-        <output-file compare="Text">user-vis-int-vis-user-lot-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-3_1">
-        <output-file compare="Text">user-vis-lot-3_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-aqlplus_1">
-        <output-file compare="Text">user-vis-lot-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-aqlplus_2">
-        <output-file compare="Text">user-vis-lot-aqlplus_2.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-aqlplus_3">
-        <output-file compare="Text">user-vis-lot-aqlplus_3.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-aqlplus_4">
-        <output-file compare="Text">user-vis-lot-aqlplus_4.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-aqlplus_5">
-        <output-file compare="Text">user-vis-lot-aqlplus_5.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-int-aqlplus_1">
-        <output-file compare="Text">user-vis-lot-int-aqlplus_1.adm</output-file>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="fuzzyjoin">
-      <compilation-unit name="user-vis-lot-int-aqlplus_2">
-        <output-file compare="Text">user-vis-lot-int-aqlplus_2.adm</output-file>
-      </compilation-unit>
-    </test-case>
   </test-group>
   <test-group name="index-join">
     <test-case FilePath="index-join">
@@ -1727,31 +1623,61 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-join">
+      <compilation-unit name="inverted-index-ngram-edit-distance-inline">
+        <output-file compare="Text">inverted-index-ngram-edit-distance-inline.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-join">
       <compilation-unit name="inverted-index-ngram-jaccard">
         <output-file compare="Text">inverted-index-ngram-jaccard.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-join">
+      <compilation-unit name="inverted-index-ngram-jaccard-inline">
+        <output-file compare="Text">inverted-index-ngram-jaccard-inline.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-join">
       <compilation-unit name="inverted-index-olist-edit-distance">
         <output-file compare="Text">inverted-index-olist-edit-distance.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-join">
+      <compilation-unit name="inverted-index-olist-edit-distance-inline">
+        <output-file compare="Text">inverted-index-olist-edit-distance-inline.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-join">
       <compilation-unit name="inverted-index-olist-jaccard">
         <output-file compare="Text">inverted-index-olist-jaccard.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-join">
+      <compilation-unit name="inverted-index-olist-jaccard-inline">
+        <output-file compare="Text">inverted-index-olist-jaccard-inline.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-join">
       <compilation-unit name="inverted-index-ulist-jaccard">
         <output-file compare="Text">inverted-index-ulist-jaccard.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-join">
+      <compilation-unit name="inverted-index-ulist-jaccard-inline">
+        <output-file compare="Text">inverted-index-ulist-jaccard-inline.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-join">
       <compilation-unit name="inverted-index-word-jaccard">
         <output-file compare="Text">inverted-index-word-jaccard.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-join">
+      <compilation-unit name="inverted-index-word-jaccard-inline">
+        <output-file compare="Text">inverted-index-word-jaccard-inline.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-join">
       <compilation-unit name="rtree-spatial-intersect-point">
         <output-file compare="Text">rtree-spatial-intersect-point.adm</output-file>
       </compilation-unit>
@@ -1764,6 +1690,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="index-selection">
+      <compilation-unit name="btree-index-rewrite-multiple">
+        <output-file compare="Text">btree-index-rewrite-multiple.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="index-selection">
       <compilation-unit name="cust-index-age-nullable">
         <output-file compare="Text">cust-index-age-nullable.adm</output-file>
       </compilation-unit>
@@ -1896,6 +1827,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="list">
+      <compilation-unit name="listify_03">
+        <output-file compare="Text">listify_03.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="list">
       <compilation-unit name="ordered-list-constructor_01">
         <output-file compare="Text">ordered-list-constructor_01.adm</output-file>
       </compilation-unit>
@@ -2461,6 +2397,16 @@
         <output-file compare="Text">open-closed-33.adm</output-file>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="open-closed">
+      <compilation-unit name="query-proposal02">
+        <output-file compare="Text">query-proposal02.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="open-closed">
+      <compilation-unit name="query-proposal">
+        <output-file compare="Text">query-proposal.adm</output-file>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="quantifiers">
     <test-case FilePath="quantifiers">
@@ -2758,16 +2704,31 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="spatial">
+      <compilation-unit name="circle_accessor">
+        <output-file compare="Text">circle_accessor.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="spatial">
       <compilation-unit name="circle-intersect-circle">
         <output-file compare="Text">circle-intersect-circle.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="spatial">
+      <compilation-unit name="create-rtree-index">
+        <output-file compare="Text">create-rtree-index.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="spatial">
       <compilation-unit name="distance-between-points">
         <output-file compare="Text">distance-between-points.adm</output-file>
       </compilation-unit>
     </test-case>
     <test-case FilePath="spatial">
+      <compilation-unit name="line_accessor">
+        <output-file compare="Text">line_accessor.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="spatial">
       <compilation-unit name="line-intersect-circle">
         <output-file compare="Text">line-intersect-circle.adm</output-file>
       </compilation-unit>
@@ -2788,6 +2749,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="spatial">
+      <compilation-unit name="point_accessor">
+        <output-file compare="Text">point_accessor.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="spatial">
       <compilation-unit name="point-equals-point">
         <output-file compare="Text">point-equals-point.adm</output-file>
       </compilation-unit>
@@ -2813,6 +2779,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="spatial">
+      <compilation-unit name="polygon_accessor">
+        <output-file compare="Text">polygon_accessor.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="spatial">
       <compilation-unit name="polygon-intersect-circle">
         <output-file compare="Text">polygon-intersect-circle.adm</output-file>
       </compilation-unit>
@@ -2828,6 +2799,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="spatial">
+      <compilation-unit name="rectangle_accessor">
+        <output-file compare="Text">rectangle_accessor.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="spatial">
       <compilation-unit name="rectangle-intersect-circle">
         <output-file compare="Text">rectangle-intersect-circle.adm</output-file>
       </compilation-unit>
@@ -3161,6 +3137,7 @@
         <output-file compare="Text">substr01.adm</output-file>
       </compilation-unit>
     </test-case>
+    <!-- Issue no 219
     <test-case FilePath="string">
       <compilation-unit name="substr04">
         <output-file compare="Text">substr04.adm</output-file>
@@ -3171,6 +3148,7 @@
         <output-file compare="Text">substr05.adm</output-file>
       </compilation-unit>
     </test-case>
+    -->
     <test-case FilePath="string">
       <compilation-unit name="substr06">
         <output-file compare="Text">substr06.adm</output-file>
@@ -3566,5 +3544,167 @@
         <output-file compare="Text">cross-dv19.adm</output-file>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="cross-dataverse">
+      <compilation-unit name="insert_across_dataverses">
+        <output-file compare="Text">insert_across_dataverses.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="cross-dataverse">
+      <compilation-unit name="join_across_dataverses">
+        <output-file compare="Text">join_across_dataverses.adm</output-file>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+  <test-group name="user-defined-functions">
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf01">
+        <output-file compare="Text">udf01.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf02">
+        <output-file compare="Text">udf02.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <!-- causes NPE: Issue 200
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf03">
+        <output-file compare="Text">udf03.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    -->
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf04">
+        <output-file compare="Text">udf04.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf05">
+        <output-file compare="Text">udf05.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf06">
+        <output-file compare="Text">udf06.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf07">
+        <output-file compare="Text">udf07.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf08">
+        <output-file compare="Text">udf08.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf09">
+        <output-file compare="Text">udf09.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf10">
+        <output-file compare="Text">udf10.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf11">
+        <output-file compare="Text">udf11.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf12">
+        <output-file compare="Text">udf12.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf13">
+        <output-file compare="Text">udf13.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf14">
+        <output-file compare="Text">udf14.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <!-- Issue 166
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf15">
+        <output-file compare="Text">udf15.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    -->
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf16">
+        <output-file compare="Text">udf16.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf17">
+        <output-file compare="Text">udf17.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf18">
+        <output-file compare="Text">udf18.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf19">
+        <output-file compare="Text">udf19.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf20">
+        <output-file compare="Text">udf20.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf21">
+        <output-file compare="Text">udf21.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf22">
+        <output-file compare="Text">udf22.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf23">
+        <output-file compare="Text">udf23.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <!-- Issue 195
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf24">
+        <output-file compare="Text">udf24.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    -->
+    <!-- Issue 218
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf25">
+        <output-file compare="Text">udf25.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    -->
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf26">
+        <output-file compare="Text">udf26.adm</output-file>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf27">
+        <output-file compare="Text">udf27.adm</output-file>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="f01">
+        <output-file compare="Text">f01.adm</output-file>
+        <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error> 
+      </compilation-unit>
+    </test-case>
   </test-group>
 </test-suite>
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
index 8d3b48a..188593c 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
@@ -2,49 +2,52 @@
 
 import java.io.Serializable;
 
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
 public class FunctionSignature implements Serializable {
-	private final String namespace;
-	private final String name;
-	private final int arity;
-	private final String rep;
+    private final String namespace;
+    private final String name;
+    private final int arity;
+    private final String rep;
 
-	public FunctionSignature(String namespace, String name, int arity) {
-		this.namespace = namespace;
-		this.name = name;
-		this.arity = arity;
-		rep = namespace + "." + name + "@" + arity;
-	}
+    public FunctionSignature(String namespace, String name, int arity) {
+        this.namespace = namespace;
+        this.name = name;
+        this.arity = arity;
+        rep = namespace + "." + name + "@" + arity;
+    }
 
-	public boolean equals(Object o) {
-		if (!(o instanceof FunctionSignature)) {
-			return false;
-		} else {
-			FunctionSignature f = ((FunctionSignature) o);
-			return ((namespace != null && namespace.equals(f.getNamespace()) || (namespace == null && f
-					.getNamespace() == null)))
-					&& name.equals(f.getName())
-					&& arity == f.getArity();
-		}
-	}
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof FunctionSignature)) {
+            return false;
+        } else {
+            FunctionSignature f = ((FunctionSignature) o);
+            return ((namespace != null && namespace.equals(f.getNamespace()) || (namespace == null && f.getNamespace() == null)))
+                    && name.equals(f.getName())
+                    && (arity == f.getArity() || arity == FunctionIdentifier.VARARGS || f.getArity() == FunctionIdentifier.VARARGS);
+        }
+    }
 
-	public String toString() {
-		return rep;
-	}
+    public String toString() {
+        return rep;
+    }
 
-	public int hashCode() {
-		return rep.hashCode();
-	}
+    @Override
+    public int hashCode() {
+        return (namespace + "." + name).hashCode();
+    }
 
-	public String getNamespace() {
-		return namespace;
-	}
+    public String getNamespace() {
+        return namespace;
+    }
 
-	public String getName() {
-		return name;
-	}
+    public String getName() {
+        return name;
+    }
 
-	public int getArity() {
-		return arity;
-	}
+    public int getArity() {
+        return arity;
+    }
 
 }
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
index dd83315..cb8f527 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
@@ -161,7 +161,7 @@
         this.defaultDataverse = defaultDataverse;
         this.stores = AsterixProperties.INSTANCE.getStores();
     }
-    
+
     public void setJobId(JobId jobId) {
         this.jobId = jobId;
     }
@@ -1197,5 +1197,4 @@
         return FormatUtils.getDefaultFormat();
     }
 
-
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
index 712843a..8832164 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
@@ -137,6 +137,7 @@
             case LINE:
             case POLYGON:
             case CIRCLE:
+            case RECTANGLE:
                 return 2;
             case POINT3D:
                 return 3;
@@ -151,6 +152,7 @@
             case LINE:
             case POLYGON:
             case CIRCLE:
+            case RECTANGLE:
                 return BuiltinType.ADOUBLE;
             default:
                 throw new NotImplementedException(typeTag + " is not a supported spatial data type.");