use of org.apache.asterix.lang.sqlpp.clause.NestClause in project asterixdb by apache.
the class SqlppCloneAndSubstituteVariablesVisitor method visit.
@Override
public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(NestClause nestClause, VariableSubstitutionEnvironment env) throws CompilationException {
VariableExpr rightVar = nestClause.getRightVariable();
VariableExpr newRightVar = generateNewVariable(context, rightVar);
VariableExpr newRightPosVar = nestClause.hasPositionalVariable() ? generateNewVariable(context, nestClause.getPositionalVariable()) : null;
// Visits the right expression.
Expression rightExpr = (Expression) nestClause.getRightExpression().accept(this, env).first;
// Visits the condition.
VariableSubstitutionEnvironment currentEnv = new VariableSubstitutionEnvironment(env);
currentEnv.removeSubstitution(newRightVar);
if (newRightPosVar != null) {
currentEnv.removeSubstitution(newRightPosVar);
}
// The condition can refer to the newRightVar and newRightPosVar.
Expression conditionExpr = (Expression) nestClause.getConditionExpression().accept(this, currentEnv).first;
NestClause newJoinClause = new NestClause(nestClause.getJoinType(), rightExpr, newRightVar, newRightPosVar, conditionExpr);
return new Pair<>(newJoinClause, currentEnv);
}
use of org.apache.asterix.lang.sqlpp.clause.NestClause in project asterixdb by apache.
the class DeepCopyVisitor method visit.
@Override
public NestClause visit(NestClause nestClause, Void arg) throws CompilationException {
Expression rightExpression = (Expression) nestClause.getRightExpression().accept(this, arg);
VariableExpr rightVar = (VariableExpr) nestClause.getRightVariable().accept(this, arg);
VariableExpr rightPositionVar = nestClause.getPositionalVariable() == null ? null : (VariableExpr) nestClause.getPositionalVariable().accept(this, arg);
Expression conditionExpresion = (Expression) nestClause.getConditionExpression().accept(this, arg);
return new NestClause(nestClause.getJoinType(), rightExpression, rightVar, rightPositionVar, conditionExpresion);
}
Aggregations