use of org.apache.asterix.lang.common.base.Expression in project asterixdb by apache.
the class DeepCopyVisitor method visit.
@Override
public JoinClause visit(JoinClause joinClause, Void arg) throws CompilationException {
Expression rightExpression = (Expression) joinClause.getRightExpression().accept(this, arg);
VariableExpr rightVar = (VariableExpr) joinClause.getRightVariable().accept(this, arg);
VariableExpr rightPositionVar = joinClause.getPositionalVariable() == null ? null : (VariableExpr) joinClause.getPositionalVariable().accept(this, arg);
Expression conditionExpresion = (Expression) joinClause.getConditionExpression().accept(this, arg);
return new JoinClause(joinClause.getJoinType(), rightExpression, rightVar, rightPositionVar, conditionExpresion);
}
use of org.apache.asterix.lang.common.base.Expression in project asterixdb by apache.
the class DeepCopyVisitor method visit.
@Override
public IfExpr visit(IfExpr ifExpr, Void arg) throws CompilationException {
Expression conditionExpr = (Expression) ifExpr.getCondExpr().accept(this, arg);
Expression thenExpr = (Expression) ifExpr.getThenExpr().accept(this, arg);
Expression elseExpr = (Expression) ifExpr.getElseExpr().accept(this, arg);
return new IfExpr(conditionExpr, thenExpr, elseExpr);
}
use of org.apache.asterix.lang.common.base.Expression in project asterixdb by apache.
the class VariableCheckAndRewriteVisitor method visit.
@Override
public Expression visit(FieldAccessor fa, ILangExpression parent) throws CompilationException {
Expression leadingExpr = fa.getExpr();
if (leadingExpr.getKind() != Kind.VARIABLE_EXPRESSION) {
fa.setExpr(leadingExpr.accept(this, fa));
return fa;
} else {
VariableExpr varExpr = (VariableExpr) leadingExpr;
String lastIdentifier = fa.getIdent().getValue();
Expression resolvedExpr = resolve(varExpr, /** Resolves within the dataverse that has the same name as the variable name. */
SqlppVariableUtil.toUserDefinedVariableName(varExpr.getVar().getValue()).getValue(), lastIdentifier, fa, parent);
if (resolvedExpr.getKind() == Kind.CALL_EXPRESSION) {
CallExpr callExpr = (CallExpr) resolvedExpr;
if (callExpr.getFunctionSignature().equals(datasetFunction)) {
// The field access is resolved to be a dataset access in the form of "dataverse.dataset".
return resolvedExpr;
}
}
fa.setExpr(resolvedExpr);
return fa;
}
}
use of org.apache.asterix.lang.common.base.Expression in project asterixdb by apache.
the class VariableCheckAndRewriteVisitor method wrapWithDatasetFunction.
private Expression wrapWithDatasetFunction(String dataverseName, String datasetName) throws CompilationException {
String fullyQualifiedName = dataverseName == null ? datasetName : dataverseName + "." + datasetName;
List<Expression> argList = new ArrayList<>();
argList.add(new LiteralExpr(new StringLiteral(fullyQualifiedName)));
return new CallExpr(datasetFunction, argList);
}
use of org.apache.asterix.lang.common.base.Expression 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;
}
Aggregations