You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org> on 2016/12/29 22:32:23 UTC

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Yingyi Bu has uploaded a new change for review.

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

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
3 files changed, 284 insertions(+), 33 deletions(-)


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

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
index 2d36a4e..58f2ac7 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
@@ -51,10 +51,17 @@
 import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 
 /**
- * This rule resolves references to undefined identifiers as:
+ * This rule resolves references to undefined identifiers with the following priority:
  * 1. expression + field-access paths, or
  * 2. datasets
  * based on the available type and metadata information.
+ *
+ *
+ * Note that undefined variables that are FROM/JOIN/UNNEST/Quantifier binding expressions
+ * will be resolved to dataset only, which has been done in
+ *
+ * @see org.apache.asterix.lang.sqlpp.rewrites.visitor.VariableCheckAndRewriteVisitor
+ *
  */
 public class ResolveVariableRule implements IAlgebraicRewriteRule {
 
@@ -144,12 +151,16 @@
             Mutable<ILogicalExpression> parentFuncRef, IOptimizationContext context) throws AlgebricksException {
         AbstractFunctionCallExpression func = (AbstractFunctionCallExpression) funcRef.getValue();
         int numVarCandidates = varAccessCandidates.size();
-        boolean hasAmbiguity = hasAmbiguity(hasMatchedDataset, fullyQualifiedDatasetPathCandidateFromParent,
-                numVarCandidates);
-        if (hasAmbiguity) {
-            // More than one possibilities.
-            throw new AlgebricksException("Cannot resolve ambiguous alias reference for undefined identifier "
-                    + unresolvedVarName);
+
+        // The resolution order: 1. field-access 2. datasets (standalone-name or fully-qualified)
+        if (numVarCandidates > 0) {
+            if (numVarCandidates == 1) {
+                resolveAsFieldAccess(funcRef, varAccessCandidates.iterator().next());
+            } else {
+                // More than one possibilities.
+                throw new AlgebricksException(
+                        "Cannot resolve ambiguous alias reference for undefined identifier " + unresolvedVarName);
+            }
         } else if (hasMatchedDataset) {
             // Rewrites the "resolve" function to a "dataset" function and only keep the dataset name argument.
             func.setFunctionInfo(FunctionUtil.getFunctionInfo(BuiltinFunctions.DATASET));
@@ -165,8 +176,6 @@
                     new MutableObject<>(new ConstantExpression(
                             new AsterixConstantValue(new AString(fullyQualifiedDatasetPathCandidateFromParent.second
                                     + "." + fullyQualifiedDatasetPathCandidateFromParent.third)))));
-        } else if (numVarCandidates == 1) {
-            resolveAsFieldAccess(funcRef, varAccessCandidates.iterator().next());
         } else {
             MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
             // Cannot find any resolution.
@@ -174,15 +183,6 @@
                     + metadataProvider.getDefaultDataverseName() + " nor an alias with name " + unresolvedVarName);
         }
         return true;
-    }
-
-    // Check whether it is possible to have multiple resolutions for a "resolve" function.
-    private boolean hasAmbiguity(boolean hasMatchedDataset,
-            Triple<Boolean, String, String> fullyQualifiedDatasetPathCandidateFromParent, int numVarCandidates) {
-        boolean hasAmbiguity = numVarCandidates > 1 || (numVarCandidates == 1 && hasMatchedDataset);
-        hasAmbiguity = hasAmbiguity || (numVarCandidates == 1 && fullyQualifiedDatasetPathCandidateFromParent.first);
-        hasAmbiguity = hasAmbiguity || (hasMatchedDataset && fullyQualifiedDatasetPathCandidateFromParent.first);
-        return hasAmbiguity;
     }
 
     // Resolves a "resolve" function call as a field access.
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
index a137b2d..a6149f8 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
@@ -36,6 +36,7 @@
 import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
+import org.apache.asterix.lang.sqlpp.visitor.CheckDatasetOnlyResolutionVisitor;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppExpressionScopingVisitor;
 import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.utils.MetadataConstants;
@@ -108,21 +109,29 @@
         // it will lead to ambiguities and the plan is going to be very complex.  An example query is:
         // asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists
         Set<VariableExpr> liveVars = SqlppVariableUtil.getLiveVariables(scopeChecker.getCurrentScope(), false);
-        boolean resolveAsDataset = resolveDatasetFirst(arg) && datasetExists(dataverseName, datasetName);
-        if (resolveAsDataset) {
-            return wrapWithDatasetFunction(dataverseName, datasetName);
-        } else if (liveVars.isEmpty()) {
-            String defaultDataverseName = metadataProvider.getDefaultDataverseName();
-            if (dataverseName == null && defaultDataverseName == null) {
-                throw new AsterixException("Cannot find dataset " + datasetName
-                        + " because there is no dataverse declared, nor an alias with name " + datasetName + "!");
+        boolean resolveToDatasetOnly = resolveToDatasetOnly(arg, varExpr);
+        boolean resolveAsDataset = datasetExists(dataverseName, datasetName);
+
+        if (resolveToDatasetOnly) {
+            if (resolveAsDataset) {
+                return wrapWithDatasetFunction(dataverseName, datasetName);
+            } else {
+                throwUnresolvableError(dataverseName, datasetName);
             }
-            //If no available dataset nor in-scope variable to resolve to, we throw an error.
-            throw new AsterixException("Cannot find dataset " + datasetName + " in dataverse "
-                    + (dataverseName == null ? defaultDataverseName : dataverseName) + " nor an alias with name "
-                    + datasetName + "!");
         }
         return wrapWithResolveFunction(varExpr, liveVars);
+    }
+
+    private void throwUnresolvableError(String dataverseName, String datasetName) throws AsterixException {
+        String defaultDataverseName = metadataProvider.getDefaultDataverseName();
+        if (dataverseName == null && defaultDataverseName == null) {
+            throw new AsterixException("Cannot find dataset " + datasetName
+                    + " because there is no dataverse declared, nor an alias with name " + datasetName + "!");
+        }
+        //If no available dataset nor in-scope variable to resolve to, we throw an error.
+        throw new AsterixException("Cannot find dataset " + datasetName + " in dataverse "
+                + (dataverseName == null ? defaultDataverseName : dataverseName) + " nor an alias with name "
+                + datasetName + "!");
     }
 
     // Checks whether we need to error the variable reference, e.g., the variable is referred
@@ -135,9 +144,10 @@
         }
     }
 
-    // For From/Join/UNNEST/NEST, we resolve the undefined identifier reference as dataset reference first.
-    private boolean resolveDatasetFirst(ILangExpression arg) {
-        return arg != null;
+    // For From/Join/UNNEST/Quantifiers, we resolve the undefined identifier reference as dataset reference only.
+    private boolean resolveToDatasetOnly(ILangExpression arg, VariableExpr variableExpr) throws AsterixException {
+        CheckDatasetOnlyResolutionVisitor visitor = new CheckDatasetOnlyResolutionVisitor();
+        return arg.accept(visitor, variableExpr);
     }
 
     // Whether a rewrite is needed for a variable reference expression.
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
new file mode 100644
index 0000000..3c8340b
--- /dev/null
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
@@ -0,0 +1,241 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one
+ *  * or more contributor license agreements.  See the NOTICE file
+ *  * distributed with this work for additional information
+ *  * regarding copyright ownership.  The ASF licenses this file
+ *  * to you under the Apache License, Version 2.0 (the
+ *  * "License"); you may not use this file except in compliance
+ *  * with the License.  You may obtain a copy of the License at
+ *  *
+ *  *   http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing,
+ *  * software distributed under the License is distributed on an
+ *  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  * KIND, either express or implied.  See the License for the
+ *  * specific language governing permissions and limitations
+ *  * under the License.
+ *
+ */
+
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import java.util.List;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
+import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+
+public class CheckDatasetOnlyResolutionVisitor extends AbstractSqlppQueryExpressionVisitor<Boolean, ILangExpression> {
+
+    @Override
+    public Boolean visit(Query q, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FunctionDecl fd, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(LiteralExpr l, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(VariableExpr v, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(ListConstructor lc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(RecordConstructor rc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(OperatorExpr ifbo, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FieldAccessor fa, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(IndexAccessor ia, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(IfExpr ifexpr, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(QuantifiedExpression qe, ILangExpression expr) throws AsterixException {
+        for (QuantifiedPair qp : qe.getQuantifiedList()) {
+            // If the target reference of undefined variable is a binding expression in a quantified pair,
+            // then we only resolve it to dataset.
+            if (expr == qp.getExpr()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Boolean visit(UnaryExpr u, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(CallExpr pf, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(LetClause lc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(WhereClause wc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(OrderbyClause oc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(GroupbyClause gc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(LimitClause lc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FromClause fromClause, ILangExpression expr) throws AsterixException {
+        return true;
+    }
+
+    @Override
+    public Boolean visit(FromTerm fromTerm, ILangExpression expr) throws AsterixException {
+        return true;
+    }
+
+    @Override
+    public Boolean visit(JoinClause joinClause, ILangExpression expr) throws AsterixException {
+        return expr == joinClause.getRightExpression();
+    }
+
+    @Override
+    public Boolean visit(NestClause nestClause, ILangExpression expr) throws AsterixException {
+        return expr == nestClause.getRightExpression();
+    }
+
+    @Override
+    public Boolean visit(Projection projection, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectBlock selectBlock, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectClause selectClause, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectElement selectElement, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectRegular selectRegular, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectExpression selectStatement, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(UnnestClause unnestClause, ILangExpression expr) throws AsterixException {
+        return true;
+    }
+
+    @Override
+    public Boolean visit(HavingClause havingClause, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws AsterixException {
+        return false;
+    }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

BAD Compatibility Tests Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/160/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1434/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6: BAD+1

BAD Compatibility Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/139/ : SUCCESS

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Yingyi Bu has submitted this change and it was merged.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1408
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
BAD: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
87 files changed, 2,314 insertions(+), 229 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; No violations found; No violations found; Verified



diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
index 2d36a4e..f8e57a1 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
@@ -51,10 +51,17 @@
 import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 
 /**
- * This rule resolves references to undefined identifiers as:
- * 1. expression + field-access paths, or
+ * This rule resolves references to undefined identifiers with the following priority:
+ * 1. field-access
  * 2. datasets
  * based on the available type and metadata information.
+ *
+ *
+ * Note that undefined variable references that are FROM/JOIN/UNNEST/Quantifier binding expressions
+ * are resolved to dataset only, which has been done in
+ *
+ * @see org.apache.asterix.lang.sqlpp.rewrites.visitor.VariableCheckAndRewriteVisitor
+ *
  */
 public class ResolveVariableRule implements IAlgebraicRewriteRule {
 
@@ -144,12 +151,16 @@
             Mutable<ILogicalExpression> parentFuncRef, IOptimizationContext context) throws AlgebricksException {
         AbstractFunctionCallExpression func = (AbstractFunctionCallExpression) funcRef.getValue();
         int numVarCandidates = varAccessCandidates.size();
-        boolean hasAmbiguity = hasAmbiguity(hasMatchedDataset, fullyQualifiedDatasetPathCandidateFromParent,
-                numVarCandidates);
-        if (hasAmbiguity) {
-            // More than one possibilities.
-            throw new AlgebricksException("Cannot resolve ambiguous alias reference for undefined identifier "
-                    + unresolvedVarName);
+
+        // The resolution order: 1. field-access 2. datasets (standalone-name or fully-qualified)
+        if (numVarCandidates > 0) {
+            if (numVarCandidates == 1) {
+                resolveAsFieldAccess(funcRef, varAccessCandidates.iterator().next());
+            } else {
+                // More than one possibilities.
+                throw new AlgebricksException(
+                        "Cannot resolve ambiguous alias reference for undefined identifier " + unresolvedVarName);
+            }
         } else if (hasMatchedDataset) {
             // Rewrites the "resolve" function to a "dataset" function and only keep the dataset name argument.
             func.setFunctionInfo(FunctionUtil.getFunctionInfo(BuiltinFunctions.DATASET));
@@ -165,8 +176,6 @@
                     new MutableObject<>(new ConstantExpression(
                             new AsterixConstantValue(new AString(fullyQualifiedDatasetPathCandidateFromParent.second
                                     + "." + fullyQualifiedDatasetPathCandidateFromParent.third)))));
-        } else if (numVarCandidates == 1) {
-            resolveAsFieldAccess(funcRef, varAccessCandidates.iterator().next());
         } else {
             MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
             // Cannot find any resolution.
@@ -174,15 +183,6 @@
                     + metadataProvider.getDefaultDataverseName() + " nor an alias with name " + unresolvedVarName);
         }
         return true;
-    }
-
-    // Check whether it is possible to have multiple resolutions for a "resolve" function.
-    private boolean hasAmbiguity(boolean hasMatchedDataset,
-            Triple<Boolean, String, String> fullyQualifiedDatasetPathCandidateFromParent, int numVarCandidates) {
-        boolean hasAmbiguity = numVarCandidates > 1 || (numVarCandidates == 1 && hasMatchedDataset);
-        hasAmbiguity = hasAmbiguity || (numVarCandidates == 1 && fullyQualifiedDatasetPathCandidateFromParent.first);
-        hasAmbiguity = hasAmbiguity || (hasMatchedDataset && fullyQualifiedDatasetPathCandidateFromParent.first);
-        return hasAmbiguity;
     }
 
     // Resolves a "resolve" function call as a field access.
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
index 5e60af3..891e463 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
@@ -30,20 +30,20 @@
 
 class ParserTestUtil {
 
-    static void suiteBuild(File dir, Collection<Object[]> testArgs, String path, String separator,
+    static void suiteBuild(File file, Collection<Object[]> testArgs, String path, String separator,
             String extensionQuery, String extensionResult, String pathExpected, String pathActual) {
-        for (File file : dir.listFiles()) {
-            if (file.isDirectory() && !file.getName().startsWith(".")) {
-                suiteBuild(file, testArgs, TestHelper.joinPath(path, file.getName()), separator, extensionQuery,
-                        extensionResult, pathExpected, pathActual);
+        if (file.isDirectory() && !file.getName().startsWith(".")) {
+            for (File innerfile : file.listFiles()) {
+                String subdir = innerfile.isDirectory() ? TestHelper.joinPath(path, innerfile.getName()) : path;
+                suiteBuild(innerfile, testArgs, subdir, separator, extensionQuery, extensionResult, pathExpected,
+                        pathActual);
             }
-            if (file.isFile() && file.getName().endsWith(extensionQuery)) {
-                String resultFileName = AsterixTestHelper.extToResExt(file.getName(), extensionResult);
-                File expectedFile = new File(TestHelper.joinPath(pathExpected, path, resultFileName));
-                File actualFile = new File(
-                        TestHelper.joinPath(pathActual, path.replace(separator, "_"), resultFileName));
-                testArgs.add(new Object[] { file, expectedFile, actualFile });
-            }
+        }
+        if (file.isFile() && file.getName().endsWith(extensionQuery)) {
+            String resultFileName = AsterixTestHelper.extToResExt(file.getName(), extensionResult);
+            File expectedFile = new File(TestHelper.joinPath(pathExpected, path, resultFileName));
+            File actualFile = new File(TestHelper.joinPath(pathActual, path, resultFileName));
+            testArgs.add(new Object[] { file, expectedFile, actualFile });
         }
     }
 
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
index 1d263cf..543f691 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
@@ -43,8 +43,12 @@
   (
     LiteralExpr [STRING] [cust]
     :
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [cust]
+      Variable [ Name=$cid ]
+      Variable [ Name=$o ]
+      Variable [ Name=#1 ]
+      Variable [ Name=$c ]
     ]
   )
   (
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
index e92496d..d50f774 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
@@ -32,8 +32,11 @@
   (
     LiteralExpr [STRING] [age]
     :
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [age]
+      Variable [ Name=$name ]
+      Variable [ Name=#1 ]
+      Variable [ Name=$c ]
     ]
   )
 ]
@@ -58,8 +61,11 @@
 Orderby
   Variable [ Name=$name ]
   DESC
-  FunctionCall Metadata.dataset@1[
+  FunctionCall Metadata.resolve@-1[
     LiteralExpr [STRING] [age]
+    Variable [ Name=$name ]
+    Variable [ Name=#1 ]
+    Variable [ Name=$c ]
   ]
   ASC
 
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
index 1b01e10..adb9a05 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
@@ -94,8 +94,13 @@
   FunctionCall events.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [es]
+        Variable [ Name=$sponsor ]
+        Variable [ Name=$event ]
+        Variable [ Name=$sig_name ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
index 8868c2f..7c28623 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
@@ -61,8 +61,10 @@
     Let Variable [ Name=$circle ]
       :=
       FunctionCall twitter.create-circle@2[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [location]
+          Variable [ Name=$tweet ]
+          Variable [ Name=$sub ]
         ]
         LiteralExpr [DOUBLE] [30.0]
       ]
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
index 5c76658..76447cd 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
@@ -60,8 +60,19 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=#5 ]
+            Variable [ Name=$lenLeft ]
+            Variable [ Name=$idLeft ]
+            Variable [ Name=$lenRight ]
+            Variable [ Name=$tokensLeft ]
+            Variable [ Name=$prefixTokenRight ]
+            Variable [ Name=$tokensRight ]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$idRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -74,13 +85,17 @@
       AS Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensLeft]
+          Variable [ Name=$paperLeft ]
+          Variable [ Name=$paperRight ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenLeft]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
@@ -93,13 +108,19 @@
       AS Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensRight]
+          Variable [ Name=$paperLeft ]
+          Variable [ Name=$paperRight ]
+          Variable [ Name=$prefixTokenLeft ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenRight]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
index a5cdcdf..5471490 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
@@ -61,8 +61,13 @@
   FunctionCall null.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [es]
+        Variable [ Name=$sponsor ]
+        Variable [ Name=$event ]
+        Variable [ Name=$sig_name ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
@@ -86,8 +91,17 @@
         FunctionCall null.sql-count@1[
           (
             SELECT ELEMENT [
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [es]
+              Variable [ Name=#4 ]
+              Variable [ Name=$e ]
+              Variable [ Name=$sponsor ]
+              Variable [ Name=$sig_sponsorship_count ]
+              Variable [ Name=$chapter_name ]
+              Variable [ Name=$event ]
+              Variable [ Name=$sig_name ]
+              Variable [ Name=#1 ]
+              Variable [ Name=#3 ]
             ]
             ]
             FROM [              Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
index 68d47d8..5211b72 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
@@ -1,7 +1,7 @@
 Query:
 Let Variable [ Name=$users ]
   :=
-  FunctionCall Metadata.dataset@1[
+  FunctionCall Metadata.resolve@-1[
     LiteralExpr [STRING] [User]
   ]
 SELECT ELEMENT [
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
index 3177516..78238d1 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
@@ -2,12 +2,26 @@
 SELECT [
 FunctionCall null.sqrt@1[
   OperatorExpr [
-    FunctionCall Metadata.dataset@1[
-      LiteralExpr [STRING] [t.a]
+    FieldAccessor [
+      FunctionCall Metadata.resolve@-1[
+        LiteralExpr [STRING] [t]
+        Variable [ Name=$u ]
+        Variable [ Name=$root ]
+        Variable [ Name=#1 ]
+        Variable [ Name=$id ]
+      ]
+      Field=a
     ]
     *
-    FunctionCall Metadata.dataset@1[
-      LiteralExpr [STRING] [t.b]
+    FieldAccessor [
+      FunctionCall Metadata.resolve@-1[
+        LiteralExpr [STRING] [t]
+        Variable [ Name=$u ]
+        Variable [ Name=$root ]
+        Variable [ Name=#1 ]
+        Variable [ Name=$id ]
+      ]
+      Field=b
     ]
   ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
index 435d2f0..b14e49b 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
@@ -102,7 +102,7 @@
 Let Variable [ Name=$result ]
   :=
   FunctionCall null.calculate@1[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [Events]
     ]
   ]
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
index 2f246e1..aa422a1 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
@@ -14,7 +14,7 @@
 FROM [  (
     Let Variable [ Name=$data ]
       :=
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [User]
       ]
     SELECT ELEMENT [
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
index 9454ebc..af44c39 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
@@ -61,8 +61,13 @@
   FunctionCall null.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [es]
+        Variable [ Name=$sponsor ]
+        Variable [ Name=$event ]
+        Variable [ Name=$sig_name ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
@@ -86,8 +91,17 @@
         FunctionCall null.sql-count@1[
           (
             SELECT ELEMENT [
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [es]
+              Variable [ Name=#4 ]
+              Variable [ Name=$e ]
+              Variable [ Name=$sponsor ]
+              Variable [ Name=$sig_sponsorship_count ]
+              Variable [ Name=$chapter_name ]
+              Variable [ Name=$event ]
+              Variable [ Name=$sig_name ]
+              Variable [ Name=#1 ]
+              Variable [ Name=#3 ]
             ]
             ]
             FROM [              Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp
new file mode 100644
index 0000000..e08ad9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 2});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp
new file mode 100644
index 0000000..097c57d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s
+where samptable >= (select value count(*) from samptable s2)[0];
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp
new file mode 100644
index 0000000..e08ad9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 2});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp
new file mode 100644
index 0000000..53cae61
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s
+where samptable >= (select value count(*) from samptable s2, samptable s3 where s2.id=s3.id)[0];
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp
new file mode 100644
index 0000000..e08ad9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 2});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp
new file mode 100644
index 0000000..7d3c8d3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s
+where samptable >= (select value count(*) from samptable s2 join samptable s3 on s2.id=s3.id)[0];
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp
new file mode 100644
index 0000000..e08ad9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 2});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp
new file mode 100644
index 0000000..8b5a409
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s
+where some s2 in samptable satisfies s2.samptable=s.samptable;
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp
new file mode 100644
index 0000000..e08ad9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 2});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp
new file mode 100644
index 0000000..6b26164
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s
+where samptable >= (select value count(*) from samptable s2 unnest samptable s3 where s2.id=s3.id)[0];
+
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
new file mode 100644
index 0000000..10fda39
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 1});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
new file mode 100644
index 0000000..2ac14e5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s
+where samptable > 0;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
new file mode 100644
index 0000000..02c9795
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
new file mode 100644
index 0000000..10fda39
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1, 'samptable': 1});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
new file mode 100644
index 0000000..2645ddc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select *
+from samptable s1, samptable s2
+where samptable > 0;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
new file mode 100644
index 0000000..f9c0dff
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test1 if exists;
+create dataverse test1;
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as closed {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
new file mode 100644
index 0000000..bd1d4df
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
new file mode 100644
index 0000000..f42f4f9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test1;
+
+select *
+from test.samptable
+where id > 0;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
new file mode 100644
index 0000000..ae4aef6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test1;
+drop dataverse test;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
new file mode 100644
index 0000000..f9c0dff
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test1 if exists;
+create dataverse test1;
+
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+drop dataset samptable if exists;
+drop type samptabletype if exists;
+
+create type samptabletype as closed {
+  id: tinyint
+};
+
+create dataset samptable(samptabletype) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
new file mode 100644
index 0000000..bd1d4df
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into samptable ({'id' : 0});
+
+insert into samptable ({'id' : 1});
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
new file mode 100644
index 0000000..7a44bfe
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test1;
+
+coll_count(test.samptable);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
new file mode 100644
index 0000000..ae4aef6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test1;
+drop dataverse test;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm
new file mode 100644
index 0000000..74f408a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm
@@ -0,0 +1 @@
+{ "s": { "id": 1, "samptable": 2 } }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
new file mode 100644
index 0000000..d18543e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
@@ -0,0 +1 @@
+{ "s": { "id": 1, "samptable": 1 } }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
new file mode 100644
index 0000000..1c21252
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
@@ -0,0 +1 @@
+{ "samptable": { "id": 1 } }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
@@ -0,0 +1 @@
+2
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
index 1d14a93..9701e92 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
@@ -37,8 +37,13 @@
   FunctionCall fuzzyjoin.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [id]
+        Variable [ Name=$token ]
+        Variable [ Name=$paper ]
+        Variable [ Name=$tokenGroupped ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
index 1d14a93..9701e92 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
@@ -37,8 +37,13 @@
   FunctionCall fuzzyjoin.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [id]
+        Variable [ Name=$token ]
+        Variable [ Name=$paper ]
+        Variable [ Name=$tokenGroupped ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
index 7306e80..d8aa69e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
@@ -37,8 +37,13 @@
   FunctionCall fuzzyjoin.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [paperid]
+        Variable [ Name=$token ]
+        Variable [ Name=$paper ]
+        Variable [ Name=$tokenGroupped ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
index fb7aaec..8d8e432 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
@@ -26,13 +26,15 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [lenDBLP]
+        Variable [ Name=$paperDBLP ]
       ]
       LiteralExpr [FLOAT] [0.5]
     ]
@@ -104,8 +106,19 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
index 83b5471..939f281 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
@@ -26,14 +26,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
index 4d4ecc8..5924f3e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
@@ -74,8 +74,15 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$token ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
index 0e7d067..bba988a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
@@ -77,8 +77,16 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$token ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
index b290858..5f6b822 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
@@ -80,8 +80,17 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
index 244cb0b..909baec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
@@ -90,8 +90,18 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
index 244cb0b..909baec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
@@ -90,8 +90,18 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
index 244cb0b..909baec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
@@ -90,8 +90,18 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
index 244cb0b..909baec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
@@ -90,8 +90,18 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
index 60e0b24..f36d0c6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
@@ -90,8 +90,18 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
index fd16f56..9158753 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
@@ -40,8 +40,19 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=#5 ]
+            Variable [ Name=$lenLeft ]
+            Variable [ Name=$idLeft ]
+            Variable [ Name=$lenRight ]
+            Variable [ Name=$tokensLeft ]
+            Variable [ Name=$prefixTokenRight ]
+            Variable [ Name=$tokensRight ]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$idRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -54,13 +65,15 @@
       AS Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensLeft]
+          Variable [ Name=$paperLeft ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenLeft]
+            Variable [ Name=$paperLeft ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
@@ -73,13 +86,19 @@
       AS Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensRight]
+          Variable [ Name=$paperLeft ]
+          Variable [ Name=$paperRight ]
+          Variable [ Name=$prefixTokenLeft ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenRight]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
index fd16f56..9158753 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
@@ -40,8 +40,19 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=#5 ]
+            Variable [ Name=$lenLeft ]
+            Variable [ Name=$idLeft ]
+            Variable [ Name=$lenRight ]
+            Variable [ Name=$tokensLeft ]
+            Variable [ Name=$prefixTokenRight ]
+            Variable [ Name=$tokensRight ]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$idRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -54,13 +65,15 @@
       AS Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensLeft]
+          Variable [ Name=$paperLeft ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenLeft]
+            Variable [ Name=$paperLeft ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
@@ -73,13 +86,19 @@
       AS Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensRight]
+          Variable [ Name=$paperLeft ]
+          Variable [ Name=$paperRight ]
+          Variable [ Name=$prefixTokenLeft ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenRight]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
index 05a8114..9ccb943 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
@@ -50,8 +50,19 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=#5 ]
+            Variable [ Name=$lenLeft ]
+            Variable [ Name=$idLeft ]
+            Variable [ Name=$lenRight ]
+            Variable [ Name=$tokensLeft ]
+            Variable [ Name=$prefixTokenRight ]
+            Variable [ Name=$tokensRight ]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$idRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -64,13 +75,17 @@
       AS Variable [ Name=$paperLeft ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensLeft]
+          Variable [ Name=$paperLeft ]
+          Variable [ Name=$paperRight ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenLeft]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
@@ -83,13 +98,19 @@
       AS Variable [ Name=$paperRight ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensRight]
+          Variable [ Name=$paperLeft ]
+          Variable [ Name=$paperRight ]
+          Variable [ Name=$prefixTokenLeft ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [lenRight]
+            Variable [ Name=$paperLeft ]
+            Variable [ Name=$paperRight ]
+            Variable [ Name=$prefixTokenLeft ]
           ]
           LiteralExpr [FLOAT] [0.5]
         ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
index d3b6600..8098058 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
@@ -29,14 +29,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -50,14 +52,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
index af18d99..f572bde 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
@@ -29,14 +29,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -50,14 +52,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -116,8 +124,18 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$paperCSX ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -196,8 +214,19 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$paperCSX ]
+                Variable [ Name=#3 ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
index e72a255..af67820 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
@@ -29,14 +29,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -50,14 +52,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -122,8 +130,19 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$paperCSX ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -208,8 +227,21 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
index ce16186..13f3e86 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
@@ -29,14 +29,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -50,14 +52,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -125,8 +133,20 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$paperCSX ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -214,8 +234,23 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
index 2b10846..d6384ce 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
@@ -17,8 +17,21 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [sim]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$idCSX ]
+        Variable [ Name=$idDBLP ]
+        Variable [ Name=$prefixTokenCSX ]
+        Variable [ Name=#5 ]
+        Variable [ Name=$tokensUnrankedCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$paperDBLP ]
+        Variable [ Name=$paperCSX ]
       ]
       Index:       LiteralExpr [LONG] [0]
     ]
@@ -31,14 +44,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -52,14 +67,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -132,8 +153,21 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -226,8 +260,25 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
index 2b10846..d6384ce 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
@@ -17,8 +17,21 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [sim]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$idCSX ]
+        Variable [ Name=$idDBLP ]
+        Variable [ Name=$prefixTokenCSX ]
+        Variable [ Name=#5 ]
+        Variable [ Name=$tokensUnrankedCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$paperDBLP ]
+        Variable [ Name=$paperCSX ]
       ]
       Index:       LiteralExpr [LONG] [0]
     ]
@@ -31,14 +44,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -52,14 +67,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -132,8 +153,21 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -226,8 +260,25 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
index 8ac97a6..7942271 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
@@ -29,14 +29,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -50,14 +52,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -130,8 +138,21 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -224,8 +245,25 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
index 2b10846..d6384ce 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
@@ -17,8 +17,21 @@
     LiteralExpr [STRING] [sim]
     :
     IndexAccessor [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [sim]
+        Variable [ Name=$lenDBLP ]
+        Variable [ Name=$tokensUnrankedDBLP ]
+        Variable [ Name=$tokensDBLP ]
+        Variable [ Name=$idCSX ]
+        Variable [ Name=$idDBLP ]
+        Variable [ Name=$prefixTokenCSX ]
+        Variable [ Name=#5 ]
+        Variable [ Name=$tokensUnrankedCSX ]
+        Variable [ Name=$prefixTokenDBLP ]
+        Variable [ Name=$lenCSX ]
+        Variable [ Name=$tokensCSX ]
+        Variable [ Name=$paperDBLP ]
+        Variable [ Name=$paperCSX ]
       ]
       Index:       LiteralExpr [LONG] [0]
     ]
@@ -31,14 +44,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -52,14 +67,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -132,8 +153,21 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -226,8 +260,25 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$tokenGrouped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
index 8ac97a6..7942271 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
@@ -29,14 +29,16 @@
   AS Variable [ Name=$paperDBLP ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensDBLP]
+      Variable [ Name=$paperDBLP ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -50,14 +52,20 @@
   AS Variable [ Name=$paperCSX ]
 ,
   FunctionCall fuzzyjoin.subset-collection@3[
-    FunctionCall Metadata.dataset@1[
+    FunctionCall Metadata.resolve@-1[
       LiteralExpr [STRING] [tokensCSX]
+      Variable [ Name=$prefixTokenDBLP ]
+      Variable [ Name=$paperDBLP ]
+      Variable [ Name=$paperCSX ]
     ]
     LiteralExpr [LONG] [0]
     FunctionCall fuzzyjoin.prefix-len-jaccard@2[
       FunctionCall fuzzyjoin.len@1[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
       ]
       LiteralExpr [FLOAT] [0.5]
@@ -130,8 +138,21 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=#1 ]
+                Variable [ Name=#2 ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#1 ]
@@ -224,8 +245,25 @@
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [id]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$paper ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$tokenUnranked ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=#3 ]
+                Variable [ Name=#4 ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=$token ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$tokenGroupped ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               ]
               FROM [                Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
index ed3dd63..a7b9ab6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
@@ -52,14 +52,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -73,14 +75,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
index ef063ba..767b6a5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
@@ -52,14 +52,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -73,14 +75,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -139,8 +147,18 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$paperCSX ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -219,8 +237,19 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$paperCSX ]
+                    Variable [ Name=#3 ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
index 2d7c141..edf93fa 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
@@ -52,14 +52,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -73,14 +75,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -145,8 +153,19 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$paperCSX ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -231,8 +250,21 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
index c68832a..336465c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
@@ -52,14 +52,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -73,14 +75,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -148,8 +156,20 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$paperCSX ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -237,8 +257,23 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedCSX ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
index b12fe05..05eb749 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
@@ -40,8 +40,21 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$idCSX ]
+            Variable [ Name=$idDBLP ]
+            Variable [ Name=$prefixTokenCSX ]
+            Variable [ Name=#5 ]
+            Variable [ Name=$tokensUnrankedCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$paperDBLP ]
+            Variable [ Name=$paperCSX ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -54,14 +67,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -75,14 +90,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -155,8 +176,21 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokenGrouped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -249,8 +283,25 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedCSX ]
+                    Variable [ Name=$tokenGrouped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$lenCSX ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
index b12fe05..05eb749 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
@@ -40,8 +40,21 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$idCSX ]
+            Variable [ Name=$idDBLP ]
+            Variable [ Name=$prefixTokenCSX ]
+            Variable [ Name=#5 ]
+            Variable [ Name=$tokensUnrankedCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$paperDBLP ]
+            Variable [ Name=$paperCSX ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -54,14 +67,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -75,14 +90,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -155,8 +176,21 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokenGrouped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -249,8 +283,25 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedCSX ]
+                    Variable [ Name=$tokenGrouped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$lenCSX ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
index b12fe05..05eb749 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
@@ -40,8 +40,21 @@
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          FunctionCall Metadata.dataset@1[
+          FunctionCall Metadata.resolve@-1[
             LiteralExpr [STRING] [sim]
+            Variable [ Name=$lenDBLP ]
+            Variable [ Name=$tokensUnrankedDBLP ]
+            Variable [ Name=$tokensDBLP ]
+            Variable [ Name=$idCSX ]
+            Variable [ Name=$idDBLP ]
+            Variable [ Name=$prefixTokenCSX ]
+            Variable [ Name=#5 ]
+            Variable [ Name=$tokensUnrankedCSX ]
+            Variable [ Name=$prefixTokenDBLP ]
+            Variable [ Name=$lenCSX ]
+            Variable [ Name=$tokensCSX ]
+            Variable [ Name=$paperDBLP ]
+            Variable [ Name=$paperCSX ]
           ]
           Index:           LiteralExpr [LONG] [0]
         ]
@@ -54,14 +67,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -75,14 +90,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -155,8 +176,21 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokenGrouped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -249,8 +283,25 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedCSX ]
+                    Variable [ Name=$tokenGrouped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$lenCSX ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
index 43d5d8d..1217164 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
@@ -52,14 +52,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -73,14 +75,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -153,8 +161,21 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -247,8 +268,25 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedCSX ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$lenCSX ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
index 866ebd8..c91d805 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
@@ -87,8 +87,21 @@
             LiteralExpr [STRING] [sim]
             :
             IndexAccessor [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [sim]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=#5 ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$tokensCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               Index:               LiteralExpr [LONG] [0]
             ]
@@ -101,14 +114,18 @@
           AS Variable [ Name=$paperDBLP ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
             LiteralExpr [LONG] [0]
             FunctionCall fuzzyjoin.prefix-len-jaccard@2[
               FunctionCall fuzzyjoin.len@1[
-                FunctionCall Metadata.dataset@1[
+                FunctionCall Metadata.resolve@-1[
                   LiteralExpr [STRING] [tokensDBLP]
+                  Variable [ Name=$paperDBLP ]
+                  Variable [ Name=$paperCSX ]
                 ]
               ]
               LiteralExpr [FLOAT] [0.5]
@@ -122,14 +139,20 @@
           AS Variable [ Name=$paperCSX ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
             LiteralExpr [LONG] [0]
             FunctionCall fuzzyjoin.prefix-len-jaccard@2[
               FunctionCall fuzzyjoin.len@1[
-                FunctionCall Metadata.dataset@1[
+                FunctionCall Metadata.resolve@-1[
                   LiteralExpr [STRING] [tokensCSX]
+                  Variable [ Name=$prefixTokenDBLP ]
+                  Variable [ Name=$paperDBLP ]
+                  Variable [ Name=$paperCSX ]
                 ]
               ]
               LiteralExpr [FLOAT] [0.5]
@@ -202,8 +225,21 @@
                   FunctionCall fuzzyjoin.sql-count@1[
                     (
                       SELECT ELEMENT [
-                      FunctionCall Metadata.dataset@1[
+                      FunctionCall Metadata.resolve@-1[
                         LiteralExpr [STRING] [id]
+                        Variable [ Name=$lenDBLP ]
+                        Variable [ Name=$tokensUnrankedDBLP ]
+                        Variable [ Name=$paper ]
+                        Variable [ Name=$tokenUnranked ]
+                        Variable [ Name=#1 ]
+                        Variable [ Name=#2 ]
+                        Variable [ Name=$idDBLP ]
+                        Variable [ Name=$prefixTokenCSX ]
+                        Variable [ Name=$token ]
+                        Variable [ Name=$tokenGrouped ]
+                        Variable [ Name=$prefixTokenDBLP ]
+                        Variable [ Name=$paperDBLP ]
+                        Variable [ Name=$paperCSX ]
                       ]
                       ]
                       FROM [                        Variable [ Name=#1 ]
@@ -296,8 +332,25 @@
                   FunctionCall fuzzyjoin.sql-count@1[
                     (
                       SELECT ELEMENT [
-                      FunctionCall Metadata.dataset@1[
+                      FunctionCall Metadata.resolve@-1[
                         LiteralExpr [STRING] [id]
+                        Variable [ Name=$lenDBLP ]
+                        Variable [ Name=$tokensUnrankedDBLP ]
+                        Variable [ Name=$paper ]
+                        Variable [ Name=$tokensDBLP ]
+                        Variable [ Name=$tokenUnranked ]
+                        Variable [ Name=$idCSX ]
+                        Variable [ Name=$idDBLP ]
+                        Variable [ Name=#3 ]
+                        Variable [ Name=#4 ]
+                        Variable [ Name=$prefixTokenCSX ]
+                        Variable [ Name=$token ]
+                        Variable [ Name=$tokensUnrankedCSX ]
+                        Variable [ Name=$tokenGrouped ]
+                        Variable [ Name=$prefixTokenDBLP ]
+                        Variable [ Name=$lenCSX ]
+                        Variable [ Name=$paperDBLP ]
+                        Variable [ Name=$paperCSX ]
                       ]
                       ]
                       FROM [                        Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
index e802dde..ee3f3d5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
@@ -87,8 +87,21 @@
             LiteralExpr [STRING] [sim]
             :
             IndexAccessor [
-              FunctionCall Metadata.dataset@1[
+              FunctionCall Metadata.resolve@-1[
                 LiteralExpr [STRING] [sim]
+                Variable [ Name=$lenDBLP ]
+                Variable [ Name=$tokensUnrankedDBLP ]
+                Variable [ Name=$tokensDBLP ]
+                Variable [ Name=$idCSX ]
+                Variable [ Name=$idDBLP ]
+                Variable [ Name=$prefixTokenCSX ]
+                Variable [ Name=#5 ]
+                Variable [ Name=$tokensUnrankedCSX ]
+                Variable [ Name=$prefixTokenDBLP ]
+                Variable [ Name=$lenCSX ]
+                Variable [ Name=$tokensCSX ]
+                Variable [ Name=$paperDBLP ]
+                Variable [ Name=$paperCSX ]
               ]
               Index:               LiteralExpr [LONG] [0]
             ]
@@ -101,14 +114,18 @@
           AS Variable [ Name=$paperDBLP ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
             LiteralExpr [LONG] [0]
             FunctionCall fuzzyjoin.prefix-len-jaccard@2[
               FunctionCall fuzzyjoin.len@1[
-                FunctionCall Metadata.dataset@1[
+                FunctionCall Metadata.resolve@-1[
                   LiteralExpr [STRING] [tokensDBLP]
+                  Variable [ Name=$paperDBLP ]
+                  Variable [ Name=$paperCSX ]
                 ]
               ]
               LiteralExpr [FLOAT] [0.5]
@@ -122,14 +139,20 @@
           AS Variable [ Name=$paperCSX ]
 ,
           FunctionCall fuzzyjoin.subset-collection@3[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
             LiteralExpr [LONG] [0]
             FunctionCall fuzzyjoin.prefix-len-jaccard@2[
               FunctionCall fuzzyjoin.len@1[
-                FunctionCall Metadata.dataset@1[
+                FunctionCall Metadata.resolve@-1[
                   LiteralExpr [STRING] [tokensCSX]
+                  Variable [ Name=$prefixTokenDBLP ]
+                  Variable [ Name=$paperDBLP ]
+                  Variable [ Name=$paperCSX ]
                 ]
               ]
               LiteralExpr [FLOAT] [0.5]
@@ -202,8 +225,21 @@
                   FunctionCall fuzzyjoin.sql-count@1[
                     (
                       SELECT ELEMENT [
-                      FunctionCall Metadata.dataset@1[
+                      FunctionCall Metadata.resolve@-1[
                         LiteralExpr [STRING] [id]
+                        Variable [ Name=$lenDBLP ]
+                        Variable [ Name=$tokensUnrankedDBLP ]
+                        Variable [ Name=$paper ]
+                        Variable [ Name=$tokenUnranked ]
+                        Variable [ Name=#1 ]
+                        Variable [ Name=#2 ]
+                        Variable [ Name=$idDBLP ]
+                        Variable [ Name=$prefixTokenCSX ]
+                        Variable [ Name=$token ]
+                        Variable [ Name=$tokenGrouped ]
+                        Variable [ Name=$prefixTokenDBLP ]
+                        Variable [ Name=$paperDBLP ]
+                        Variable [ Name=$paperCSX ]
                       ]
                       ]
                       FROM [                        Variable [ Name=#1 ]
@@ -296,8 +332,25 @@
                   FunctionCall fuzzyjoin.sql-count@1[
                     (
                       SELECT ELEMENT [
-                      FunctionCall Metadata.dataset@1[
+                      FunctionCall Metadata.resolve@-1[
                         LiteralExpr [STRING] [id]
+                        Variable [ Name=$lenDBLP ]
+                        Variable [ Name=$tokensUnrankedDBLP ]
+                        Variable [ Name=$paper ]
+                        Variable [ Name=$tokensDBLP ]
+                        Variable [ Name=$tokenUnranked ]
+                        Variable [ Name=$idCSX ]
+                        Variable [ Name=$idDBLP ]
+                        Variable [ Name=#3 ]
+                        Variable [ Name=#4 ]
+                        Variable [ Name=$prefixTokenCSX ]
+                        Variable [ Name=$token ]
+                        Variable [ Name=$tokensUnrankedCSX ]
+                        Variable [ Name=$tokenGrouped ]
+                        Variable [ Name=$prefixTokenDBLP ]
+                        Variable [ Name=$lenCSX ]
+                        Variable [ Name=$paperDBLP ]
+                        Variable [ Name=$paperCSX ]
                       ]
                       ]
                       FROM [                        Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
index 43d5d8d..1217164 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
@@ -52,14 +52,16 @@
       AS Variable [ Name=$paperDBLP ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensDBLP]
+          Variable [ Name=$paperDBLP ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensDBLP]
+              Variable [ Name=$paperDBLP ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -73,14 +75,20 @@
       AS Variable [ Name=$paperCSX ]
 ,
       FunctionCall fuzzyjoin.subset-collection@3[
-        FunctionCall Metadata.dataset@1[
+        FunctionCall Metadata.resolve@-1[
           LiteralExpr [STRING] [tokensCSX]
+          Variable [ Name=$prefixTokenDBLP ]
+          Variable [ Name=$paperDBLP ]
+          Variable [ Name=$paperCSX ]
         ]
         LiteralExpr [LONG] [0]
         FunctionCall fuzzyjoin.prefix-len-jaccard@2[
           FunctionCall fuzzyjoin.len@1[
-            FunctionCall Metadata.dataset@1[
+            FunctionCall Metadata.resolve@-1[
               LiteralExpr [STRING] [tokensCSX]
+              Variable [ Name=$prefixTokenDBLP ]
+              Variable [ Name=$paperDBLP ]
+              Variable [ Name=$paperCSX ]
             ]
           ]
           LiteralExpr [FLOAT] [0.5]
@@ -153,8 +161,21 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=#1 ]
+                    Variable [ Name=#2 ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#1 ]
@@ -247,8 +268,25 @@
               FunctionCall fuzzyjoin.sql-count@1[
                 (
                   SELECT ELEMENT [
-                  FunctionCall Metadata.dataset@1[
+                  FunctionCall Metadata.resolve@-1[
                     LiteralExpr [STRING] [id]
+                    Variable [ Name=$lenDBLP ]
+                    Variable [ Name=$tokensUnrankedDBLP ]
+                    Variable [ Name=$paper ]
+                    Variable [ Name=$tokensDBLP ]
+                    Variable [ Name=$tokenUnranked ]
+                    Variable [ Name=$idCSX ]
+                    Variable [ Name=$idDBLP ]
+                    Variable [ Name=#3 ]
+                    Variable [ Name=#4 ]
+                    Variable [ Name=$prefixTokenCSX ]
+                    Variable [ Name=$token ]
+                    Variable [ Name=$tokensUnrankedCSX ]
+                    Variable [ Name=$tokenGroupped ]
+                    Variable [ Name=$prefixTokenDBLP ]
+                    Variable [ Name=$lenCSX ]
+                    Variable [ Name=$paperDBLP ]
+                    Variable [ Name=$paperCSX ]
                   ]
                   ]
                   FROM [                    Variable [ Name=#3 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
index 1113fa8..035e97e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
@@ -9,8 +9,12 @@
   FunctionCall test.sql-count@1[
     (
       SELECT ELEMENT [
-      FunctionCall Metadata.dataset@1[
+      FunctionCall Metadata.resolve@-1[
         LiteralExpr [STRING] [id]
+        Variable [ Name=$int_m ]
+        Variable [ Name=$x ]
+        Variable [ Name=#1 ]
+        Variable [ Name=#2 ]
       ]
       ]
       FROM [        Variable [ Name=#1 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
index 83b1f68..5f9294c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
@@ -5,7 +5,7 @@
 Query:
 Let Variable [ Name=$z ]
   :=
-  FunctionCall Metadata.dataset@1[
+  FunctionCall Metadata.resolve@-1[
     LiteralExpr [STRING] [y]
   ]
 SELECT ELEMENT [
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index bd3266e..8c92b6b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -4803,6 +4803,54 @@
         </test-case> -->
   </test-group>
   &RecordsQueries;
+  <test-group name="resolution">
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-field-dataset">
+        <output-dir compare="Text">conflict-field-dataset</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-field-dataset-from">
+        <output-dir compare="Text">conflict-field-dataset-from</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-field-dataset-fromterm">
+        <output-dir compare="Text">conflict-field-dataset-from</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-field-dataset-join">
+        <output-dir compare="Text">conflict-field-dataset-from</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-field-dataset-quantifier">
+        <output-dir compare="Text">conflict-field-dataset-from</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-field-dataset-unnest">
+        <output-dir compare="Text">conflict-field-dataset-from</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="conflict-fields-dataset">
+        <output-dir compare="Text">conflict-field-dataset</output-dir>
+        <expected-error>Cannot resolve ambiguous alias reference for undefined identifier samptable</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="fullyqualified">
+        <output-dir compare="Text">fullyqualified</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="resolution">
+      <compilation-unit name="fullyqualified2">
+        <output-dir compare="Text">fullyqualified2</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
   <test-group name="scan">
     <test-case FilePath="scan">
       <compilation-unit name="10">
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
index a137b2d..311a4ea 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
@@ -36,6 +36,7 @@
 import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
+import org.apache.asterix.lang.sqlpp.visitor.CheckDatasetOnlyResolutionVisitor;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppExpressionScopingVisitor;
 import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.utils.MetadataConstants;
@@ -64,7 +65,7 @@
     }
 
     @Override
-    public Expression visit(FieldAccessor fa, ILangExpression arg) throws AsterixException {
+    public Expression visit(FieldAccessor fa, ILangExpression parent) throws AsterixException {
         Expression leadingExpr = fa.getExpr();
         if (leadingExpr.getKind() != Kind.VARIABLE_EXPRESSION) {
             fa.setExpr(leadingExpr.accept(this, fa));
@@ -75,7 +76,7 @@
             Expression resolvedExpr = resolve(varExpr,
                     /** Resolves within the dataverse that has the same name as the variable name. */
                     SqlppVariableUtil.toUserDefinedVariableName(varExpr.getVar().getValue()).getValue(), lastIdentifier,
-                    arg);
+                    fa, parent);
             if (resolvedExpr.getKind() == Kind.CALL_EXPRESSION) {
                 CallExpr callExpr = (CallExpr) resolvedExpr;
                 if (callExpr.getFunctionSignature().equals(datasetFunction)) {
@@ -89,13 +90,14 @@
     }
 
     @Override
-    public Expression visit(VariableExpr varExpr, ILangExpression arg) throws AsterixException {
+    public Expression visit(VariableExpr varExpr, ILangExpression parent) throws AsterixException {
         return resolve(varExpr, null /** Resolves within the default dataverse. */
-                , SqlppVariableUtil.toUserDefinedVariableName(varExpr.getVar().getValue()).getValue(), arg);
+                , SqlppVariableUtil.toUserDefinedVariableName(varExpr.getVar().getValue()).getValue(), varExpr, parent);
     }
 
     // Resolve a variable expression with dataverse name and dataset name.
-    private Expression resolve(VariableExpr varExpr, String dataverseName, String datasetName, ILangExpression arg)
+    private Expression resolve(VariableExpr varExpr, String dataverseName, String datasetName,
+            Expression originalExprWithUndefinedIdentifier, ILangExpression parent)
             throws AsterixException {
         String varName = varExpr.getVar().getValue();
         checkError(varName);
@@ -108,21 +110,29 @@
         // it will lead to ambiguities and the plan is going to be very complex.  An example query is:
         // asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists
         Set<VariableExpr> liveVars = SqlppVariableUtil.getLiveVariables(scopeChecker.getCurrentScope(), false);
-        boolean resolveAsDataset = resolveDatasetFirst(arg) && datasetExists(dataverseName, datasetName);
-        if (resolveAsDataset) {
-            return wrapWithDatasetFunction(dataverseName, datasetName);
-        } else if (liveVars.isEmpty()) {
-            String defaultDataverseName = metadataProvider.getDefaultDataverseName();
-            if (dataverseName == null && defaultDataverseName == null) {
-                throw new AsterixException("Cannot find dataset " + datasetName
-                        + " because there is no dataverse declared, nor an alias with name " + datasetName + "!");
+        boolean resolveToDatasetOnly = resolveToDatasetOnly(originalExprWithUndefinedIdentifier, parent);
+        boolean resolveAsDataset = datasetExists(dataverseName, datasetName);
+
+        if (resolveToDatasetOnly) {
+            if (resolveAsDataset) {
+                return wrapWithDatasetFunction(dataverseName, datasetName);
+            } else {
+                throwUnresolvableError(dataverseName, datasetName);
             }
-            //If no available dataset nor in-scope variable to resolve to, we throw an error.
-            throw new AsterixException("Cannot find dataset " + datasetName + " in dataverse "
-                    + (dataverseName == null ? defaultDataverseName : dataverseName) + " nor an alias with name "
-                    + datasetName + "!");
         }
         return wrapWithResolveFunction(varExpr, liveVars);
+    }
+
+    private void throwUnresolvableError(String dataverseName, String datasetName) throws AsterixException {
+        String defaultDataverseName = metadataProvider.getDefaultDataverseName();
+        if (dataverseName == null && defaultDataverseName == null) {
+            throw new AsterixException("Cannot find dataset " + datasetName
+                    + " because there is no dataverse declared, nor an alias with name " + datasetName + "!");
+        }
+        //If no available dataset nor in-scope variable to resolve to, we throw an error.
+        throw new AsterixException("Cannot find dataset " + datasetName + " in dataverse "
+                + (dataverseName == null ? defaultDataverseName : dataverseName) + " nor an alias with name "
+                + datasetName + "!");
     }
 
     // Checks whether we need to error the variable reference, e.g., the variable is referred
@@ -135,9 +145,12 @@
         }
     }
 
-    // For From/Join/UNNEST/NEST, we resolve the undefined identifier reference as dataset reference first.
-    private boolean resolveDatasetFirst(ILangExpression arg) {
-        return arg != null;
+    // For a From/Join/UNNEST/Quantifiers binding expression, we resolve the undefined identifier reference as
+    // a dataset access only.
+    private boolean resolveToDatasetOnly(Expression originalExpressionWithUndefinedIdentifier, ILangExpression parent)
+            throws AsterixException {
+        CheckDatasetOnlyResolutionVisitor visitor = new CheckDatasetOnlyResolutionVisitor();
+        return parent.accept(visitor, originalExpressionWithUndefinedIdentifier);
     }
 
     // Whether a rewrite is needed for a variable reference expression.
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
new file mode 100644
index 0000000..df909bd
--- /dev/null
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
@@ -0,0 +1,239 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one
+ *  * or more contributor license agreements.  See the NOTICE file
+ *  * distributed with this work for additional information
+ *  * regarding copyright ownership.  The ASF licenses this file
+ *  * to you under the Apache License, Version 2.0 (the
+ *  * "License"); you may not use this file except in compliance
+ *  * with the License.  You may obtain a copy of the License at
+ *  *
+ *  *   http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing,
+ *  * software distributed under the License is distributed on an
+ *  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  * KIND, either express or implied.  See the License for the
+ *  * specific language governing permissions and limitations
+ *  * under the License.
+ *
+ */
+
+package org.apache.asterix.lang.sqlpp.visitor;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.ILangExpression;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.sqlpp.clause.FromClause;
+import org.apache.asterix.lang.sqlpp.clause.FromTerm;
+import org.apache.asterix.lang.sqlpp.clause.HavingClause;
+import org.apache.asterix.lang.sqlpp.clause.JoinClause;
+import org.apache.asterix.lang.sqlpp.clause.NestClause;
+import org.apache.asterix.lang.sqlpp.clause.Projection;
+import org.apache.asterix.lang.sqlpp.clause.SelectBlock;
+import org.apache.asterix.lang.sqlpp.clause.SelectClause;
+import org.apache.asterix.lang.sqlpp.clause.SelectElement;
+import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
+import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
+import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
+import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
+import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
+import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
+import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
+
+/**
+ * This class checks whether a reference to an undefined identifier (the second parameter of the visit method)
+ * that is directly enclosed in the first parameter of the visit method should only be resolved to a dataset.
+ */
+public class CheckDatasetOnlyResolutionVisitor extends AbstractSqlppQueryExpressionVisitor<Boolean, ILangExpression> {
+
+    @Override
+    public Boolean visit(Query q, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FunctionDecl fd, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(LiteralExpr l, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(VariableExpr v, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(ListConstructor lc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(RecordConstructor rc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(OperatorExpr ifbo, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FieldAccessor fa, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(IndexAccessor ia, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(IfExpr ifexpr, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(QuantifiedExpression qe, ILangExpression expr) throws AsterixException {
+        for (QuantifiedPair qp : qe.getQuantifiedList()) {
+            // If the target reference of undefined variable is a binding expression in a quantified pair,
+            // then we only resolve it to dataset.
+            if (expr == qp.getExpr()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Boolean visit(UnaryExpr u, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(CallExpr pf, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(LetClause lc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(WhereClause wc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(OrderbyClause oc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(GroupbyClause gc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(LimitClause lc, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FromClause fromClause, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(FromTerm fromTerm, ILangExpression expr) throws AsterixException {
+        return expr == fromTerm.getLeftExpression();
+    }
+
+    @Override
+    public Boolean visit(JoinClause joinClause, ILangExpression expr) throws AsterixException {
+        return expr == joinClause.getRightExpression();
+    }
+
+    @Override
+    public Boolean visit(NestClause nestClause, ILangExpression expr) throws AsterixException {
+        return expr == nestClause.getRightExpression();
+    }
+
+    @Override
+    public Boolean visit(Projection projection, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectBlock selectBlock, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectClause selectClause, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectElement selectElement, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectRegular selectRegular, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(SelectExpression selectStatement, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(UnnestClause unnestClause, ILangExpression expr) throws AsterixException {
+        return expr == unnestClause.getRightExpression();
+    }
+
+    @Override
+    public Boolean visit(HavingClause havingClause, ILangExpression expr) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws AsterixException {
+        return false;
+    }
+
+    @Override
+    public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws AsterixException {
+        return false;
+    }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 8
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Yingyi Bu has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6:

(1 comment)

https://asterix-gerrit.ics.uci.edu/#/c/1408/6/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
File asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java:

Line 40:                 String subdir = innerfile.isDirectory() ? path + innerfile.getName() + separator : path;
> Isn't TestHelper.joinPath a more robust way to join paths than string conca
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: Yes

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 4: BAD-1

BAD Compatibility Tests Failed

https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/138/ : UNSTABLE

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1415/ : SUCCESS

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6:

Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1415/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 2:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3700/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

Integration Tests Failed

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1434/ : UNSTABLE

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Till Westmann (Code Review)" <do...@asterixdb.incubator.apache.org>.
Till Westmann has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 4: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1414/ : SUCCESS

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7: Integration-Tests-1

Integration Tests Failed

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1433/ : UNSTABLE

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Till Westmann (Code Review)" <do...@asterixdb.incubator.apache.org>.
Till Westmann has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6:

(1 comment)

Look good. Just one question on the ParserTestUtils and one more general question: I notice, that many of the changed ASTs are for fuzzyjoins. Is there something specific about those queries that makes a runtime resolution more likely?

https://asterix-gerrit.ics.uci.edu/#/c/1408/6/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
File asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java:

Line 40:                 String subdir = innerfile.isDirectory() ? path + innerfile.getName() + separator : path;
Isn't TestHelper.joinPath a more robust way to join paths than string concatenation? This seems to rely on the fact that "path" ends with a file separator.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-HasComments: Yes

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7: BAD+1

BAD Compatibility Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/160/ : SUCCESS

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3704/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 6:

BAD Compatibility Tests Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/139/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1437/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,

I'd like you to reexamine a change.  Please visit

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

to look at the new patch set (#5).

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
87 files changed, 2,319 insertions(+), 229 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/1408/5
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1408
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 5
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,

I'd like you to reexamine a change.  Please visit

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

to look at the new patch set (#4).

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset2/conflict-field-dataset2.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
84 files changed, 2,005 insertions(+), 124 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/1408/4
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1408
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,

I'd like you to reexamine a change.  Please visit

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

to look at the new patch set (#3).

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset2/conflict-field-dataset2.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
84 files changed, 2,015 insertions(+), 123 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/1408/3
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1408
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,

I'd like you to reexamine a change.  Please visit

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

to look at the new patch set (#7).

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
87 files changed, 2,314 insertions(+), 229 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/1408/7
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1408
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 4:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3702/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Yingyi Bu has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

Hi Till,

   For your question:
   "I notice, that many of the changed ASTs are for fuzzyjoins. Is there something specific about those queries that makes a runtime resolution more likely?"

    
    There is nothing special in those queries.  This change fixed the application stability issue that exists in the master.  The parser test runs in a *mocked* environment:
    
    -- The mocked metadata provider always returns true for any dataset existence inquiries;
    
    -- Therefore, previously, in the test, those undefined identifiers are resolved as datasets.  Now, we fixed the resolution order according the description in ASTERIXDB-1650, and then those identifiers should always be resolved to field-accesses first if possible, and finally be resolved to datasets.

    Let me know if you have further questions. Thx!
 
Best,
Yingyi

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 5:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3703/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 5
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3698/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 3:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3701/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1437/ : SUCCESS

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/3732/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,

I'd like you to reexamine a change.  Please visit

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

to look at the new patch set (#2).

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset2/conflict-field-dataset2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset3/conflict-field-dataset3.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset4/conflict-field-dataset4.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset5/conflict-field-dataset5.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset6/conflict-field-dataset6.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset2/conflict-field-dataset2.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
37 files changed, 1,107 insertions(+), 33 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/1408/2
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1408
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 4:

Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1414/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 7:

Integration Tests Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/1433/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 7
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Yingyi Bu <bu...@gmail.com>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Yingyi Bu (Code Review)" <do...@asterixdb.incubator.apache.org>.
Hello Jenkins,

I'd like you to reexamine a change.  Please visit

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

to look at the new patch set (#6).

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................

ASTERIXDB-1650: fix undefined variable reference resolution.

The order of resolving a reference to an undefined variable is:
-- If the reference to an undefined variable is the binding expression for FROM/JOIN/UNNEST/Quantifier,
   then it can only be resolved to a dataset;
-- Otherwise, it is firstly resolved as a field-access. If the system couldn't find a candidate
   field access, it is then resolved to a dataset.

Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestUtil.java
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orderby-desc-using-gby.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/rtree-index-join/query-issue838.ast
M asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
M asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-from/conflict-field-dataset-from.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-fromterm/conflict-field-dataset-fromterm.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-join/conflict-field-dataset-join.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-quantifier/conflict-field-dataset-quantifier.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset-unnest/conflict-field-dataset-unnest.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-field-dataset/conflict-field-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/conflict-fields-dataset/conflict-fields-dataset.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified/fullyqualified.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.1.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.2.update.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/resolution/fullyqualified2/fullyqualified2.4.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset-from/conflict-field-dataset-from.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/conflict-field-dataset/conflict-field-dataset.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified/fullyqualified.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/resolution/fullyqualified2/fullyqualified2.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.2/dblp-2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1/dblp-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/open-closed/query-issue456/query-issue456.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/user-defined-functions/udf30/udf30.1.ast
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/VariableCheckAndRewriteVisitor.java
A asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
87 files changed, 2,317 insertions(+), 229 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/1408/6
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1408
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>

Change in asterixdb[master]: ASTERIXDB-1650: fix undefined variable reference resolution.

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

Change subject: ASTERIXDB-1650: fix undefined variable reference resolution.
......................................................................


Patch Set 4:

BAD Compatibility Tests Started https://asterix-jenkins.ics.uci.edu/job/asterixbad-compat/138/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24e4c1b38e53c97380cfb3e2e9b61cdd05fe7002
Gerrit-PatchSet: 4
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <bu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No