Search in sources :

Example 1 with IndexAccessor

use of org.apache.asterix.lang.common.expression.IndexAccessor in project asterixdb by apache.

the class DeepCopyVisitor method visit.

@Override
public Expression visit(IndexAccessor ia, Void arg) throws CompilationException {
    Expression expr = (Expression) ia.getExpr().accept(this, arg);
    Expression indexExpr = null;
    if (ia.getIndexExpr() != null) {
        indexExpr = (Expression) ia.getIndexExpr().accept(this, arg);
    }
    return new IndexAccessor(expr, indexExpr);
}
Also used : ILangExpression(org.apache.asterix.lang.common.base.ILangExpression) Expression(org.apache.asterix.lang.common.base.Expression) SelectExpression(org.apache.asterix.lang.sqlpp.expression.SelectExpression) CaseExpression(org.apache.asterix.lang.sqlpp.expression.CaseExpression) QuantifiedExpression(org.apache.asterix.lang.common.expression.QuantifiedExpression) IndexAccessor(org.apache.asterix.lang.common.expression.IndexAccessor)

Example 2 with IndexAccessor

use of org.apache.asterix.lang.common.expression.IndexAccessor in project asterixdb by apache.

the class CloneAndSubstituteVariablesVisitor method visit.

@Override
public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(IndexAccessor ia, VariableSubstitutionEnvironment env) throws CompilationException {
    Pair<ILangExpression, VariableSubstitutionEnvironment> p1 = ia.getExpr().accept(this, env);
    Expression indexExpr = null;
    if (!ia.isAny()) {
        Pair<ILangExpression, VariableSubstitutionEnvironment> p2 = ia.getIndexExpr().accept(this, env);
        indexExpr = (Expression) p2.first;
    }
    IndexAccessor i = new IndexAccessor((Expression) p1.first, indexExpr);
    i.setAny(ia.isAny());
    return new Pair<>(i, env);
}
Also used : VariableSubstitutionEnvironment(org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment) ILangExpression(org.apache.asterix.lang.common.base.ILangExpression) QuantifiedExpression(org.apache.asterix.lang.common.expression.QuantifiedExpression) Expression(org.apache.asterix.lang.common.base.Expression) IndexAccessor(org.apache.asterix.lang.common.expression.IndexAccessor) ILangExpression(org.apache.asterix.lang.common.base.ILangExpression) GbyVariableExpressionPair(org.apache.asterix.lang.common.expression.GbyVariableExpressionPair) Pair(org.apache.hyracks.algebricks.common.utils.Pair) QuantifiedPair(org.apache.asterix.lang.common.struct.QuantifiedPair)

Aggregations

Expression (org.apache.asterix.lang.common.base.Expression)2 ILangExpression (org.apache.asterix.lang.common.base.ILangExpression)2 IndexAccessor (org.apache.asterix.lang.common.expression.IndexAccessor)2 QuantifiedExpression (org.apache.asterix.lang.common.expression.QuantifiedExpression)2 GbyVariableExpressionPair (org.apache.asterix.lang.common.expression.GbyVariableExpressionPair)1 VariableSubstitutionEnvironment (org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment)1 QuantifiedPair (org.apache.asterix.lang.common.struct.QuantifiedPair)1 CaseExpression (org.apache.asterix.lang.sqlpp.expression.CaseExpression)1 SelectExpression (org.apache.asterix.lang.sqlpp.expression.SelectExpression)1 Pair (org.apache.hyracks.algebricks.common.utils.Pair)1