use of org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause in project asterixdb by apache.
the class SqlppAstPrintVisitor method visit.
@Override
public Void visit(FromTerm fromTerm, Integer step) throws CompilationException {
fromTerm.getLeftExpression().accept(this, step);
out.print(skip(step) + "AS ");
fromTerm.getLeftVariable().accept(this, 0);
if (fromTerm.hasPositionalVariable()) {
out.println(" AT ");
fromTerm.getPositionalVariable().accept(this, 0);
}
if (fromTerm.hasCorrelateClauses()) {
for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
correlateClause.accept(this, step);
}
}
return null;
}
use of org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause in project asterixdb by apache.
the class SqlppInlineUdfsVisitor method visit.
@Override
public Boolean visit(FromTerm fromTerm, List<FunctionDecl> func) throws CompilationException {
boolean changed = false;
Pair<Boolean, Expression> p = inlineUdfsInExpr(fromTerm.getLeftExpression(), func);
fromTerm.setLeftExpression(p.second);
changed |= p.first;
for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
changed |= correlateClause.accept(this, func);
}
return changed;
}
use of org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause in project asterixdb by apache.
the class DeepCopyVisitor method visit.
@Override
public FromTerm visit(FromTerm fromTerm, Void arg) throws CompilationException {
// Visit the left expression of a from term.
Expression fromExpr = (Expression) fromTerm.getLeftExpression().accept(this, arg);
VariableExpr fromVar = (VariableExpr) fromTerm.getLeftVariable().accept(this, arg);
VariableExpr positionVar = fromTerm.getPositionalVariable() == null ? null : (VariableExpr) fromTerm.getPositionalVariable().accept(this, arg);
// Visits join/unnest/nest clauses.
List<AbstractBinaryCorrelateClause> correlateClauses = new ArrayList<>();
for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
correlateClauses.add((AbstractBinaryCorrelateClause) correlateClause.accept(this, arg));
}
return new FromTerm(fromExpr, fromVar, positionVar, correlateClauses);
}
use of org.apache.asterix.lang.sqlpp.clause.AbstractBinaryCorrelateClause in project asterixdb by apache.
the class SqlppVariableUtil method getBindingVariables.
public static Collection<VariableExpr> getBindingVariables(FromTerm fromTerm) {
List<VariableExpr> bindingVars = new ArrayList<>();
if (fromTerm == null) {
return bindingVars;
}
bindingVars.add(fromTerm.getLeftVariable());
if (fromTerm.hasPositionalVariable()) {
bindingVars.add(fromTerm.getPositionalVariable());
}
for (AbstractBinaryCorrelateClause correlateClause : fromTerm.getCorrelateClauses()) {
bindingVars.add(correlateClause.getRightVariable());
if (correlateClause.hasPositionalVariable()) {
bindingVars.add(correlateClause.getPositionalVariable());
}
}
return bindingVars;
}
Aggregations