Search in sources :

Example 6 with IfExpression

use of org.apache.drill.common.expression.IfExpression in project drill by apache.

the class ConditionalExprOptimizer method visitIfExpression.

@Override
public LogicalExpression visitIfExpression(IfExpression ifExpr, Void value) throws RuntimeException {
    LogicalExpression newElseExpr = ifExpr.elseExpression.accept(this, value);
    IfCondition conditions = ifExpr.ifCondition;
    LogicalExpression newCondition = conditions.condition.accept(this, value);
    LogicalExpression newExpr = conditions.expression.accept(this, value);
    conditions = new IfExpression.IfCondition(newCondition, newExpr);
    return IfExpression.newBuilder().setElse(newElseExpr).setIfCondition(conditions).build();
}
Also used : LogicalExpression(org.apache.drill.common.expression.LogicalExpression) IfExpression(org.apache.drill.common.expression.IfExpression) IfCondition(org.apache.drill.common.expression.IfExpression.IfCondition) IfCondition(org.apache.drill.common.expression.IfExpression.IfCondition)

Aggregations

IfExpression (org.apache.drill.common.expression.IfExpression)6 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)6 ErrorCollector (org.apache.drill.common.expression.ErrorCollector)3 ErrorCollectorImpl (org.apache.drill.common.expression.ErrorCollectorImpl)3 IfCondition (org.apache.drill.common.expression.IfExpression.IfCondition)3 NamedExpression (org.apache.drill.common.logical.data.NamedExpression)2 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)2 ValueVectorWriteExpression (org.apache.drill.exec.expr.ValueVectorWriteExpression)2 MaterializedField (org.apache.drill.exec.record.MaterializedField)2 ValueVector (org.apache.drill.exec.vector.ValueVector)2 NonStrictExpectations (mockit.NonStrictExpectations)1 FieldReference (org.apache.drill.common.expression.FieldReference)1 FunctionCall (org.apache.drill.common.expression.FunctionCall)1 ValueExpressions (org.apache.drill.common.expression.ValueExpressions)1 IntExpression (org.apache.drill.common.expression.ValueExpressions.IntExpression)1 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)1 ExecTest (org.apache.drill.exec.ExecTest)1 HoldingContainer (org.apache.drill.exec.expr.ClassGenerator.HoldingContainer)1 HoldingContainerExpression (org.apache.drill.exec.expr.HoldingContainerExpression)1 HashTableConfig (org.apache.drill.exec.physical.impl.common.HashTableConfig)1