Search in sources :

Example 1 with AQLCloneAndSubstituteVariablesVisitor

use of org.apache.asterix.lang.aql.visitor.AQLCloneAndSubstituteVariablesVisitor in project asterixdb by apache.

the class AQLVariableSubstitutionUtil method substituteVariable.

public static ILangExpression substituteVariable(ILangExpression expression, Map<VariableExpr, Expression> varExprMap) throws CompilationException {
    AQLCloneAndSubstituteVariablesVisitor visitor = new AQLCloneAndSubstituteVariablesVisitor(new LangRewritingContext(0));
    VariableSubstitutionEnvironment env = new VariableSubstitutionEnvironment(varExprMap);
    return expression.accept(visitor, env).first;
}
Also used : VariableSubstitutionEnvironment(org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment) AQLCloneAndSubstituteVariablesVisitor(org.apache.asterix.lang.aql.visitor.AQLCloneAndSubstituteVariablesVisitor) LangRewritingContext(org.apache.asterix.lang.common.rewrites.LangRewritingContext)

Aggregations

AQLCloneAndSubstituteVariablesVisitor (org.apache.asterix.lang.aql.visitor.AQLCloneAndSubstituteVariablesVisitor)1 LangRewritingContext (org.apache.asterix.lang.common.rewrites.LangRewritingContext)1 VariableSubstitutionEnvironment (org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment)1