Class OutputWidthVisitor
java.lang.Object
org.apache.drill.common.expression.visitors.AbstractExprVisitor<T,VAL,EXCEP>
org.apache.drill.exec.expr.AbstractExecExprVisitor<OutputWidthExpression,OutputWidthVisitorState,RuntimeException>
org.apache.drill.exec.physical.impl.project.OutputWidthVisitor
- All Implemented Interfaces:
ExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException>
public class OutputWidthVisitor
extends AbstractExecExprVisitor<OutputWidthExpression,OutputWidthVisitorState,RuntimeException>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvisitFixedLenExpr
(OutputWidthExpression.FixedLenExpr fixedLenExpr, OutputWidthVisitorState state) visitFunctionCallExpr
(OutputWidthExpression.FunctionCallExpr functionCallExpr, OutputWidthVisitorState state) Converts aOutputWidthExpression.FunctionCallExpr
to aOutputWidthExpression.FixedLenExpr
by passing the the args of the function to the width calculator for this function.visitFunctionHolderExpression
(FunctionHolderExpression holderExpr, OutputWidthVisitorState state) Handles aFunctionHolderExpression
.visitIfElseWidthExpr
(OutputWidthExpression.IfElseWidthExpr ifElseWidthExpr, OutputWidthVisitorState state) Converts theOutputWidthExpression.IfElseWidthExpr
to aOutputWidthExpression.FixedLenExpr
by taking the max of the if-expr-width and the else-expr-width.visitIfExpression
(IfExpression ifExpression, OutputWidthVisitorState state) Records theIfExpression
as aOutputWidthExpression.IfElseWidthExpr
.visitNullConstant
(TypedNullConstant nullConstant, OutputWidthVisitorState state) visitQuotedStringConstant
(ValueExpressions.QuotedString quotedString, OutputWidthVisitorState state) visitUnknown
(LogicalExpression logicalExpression, OutputWidthVisitorState state) Handles implementation-specific expressions not known to the visitor structure.Records a variable width read expression as aOutputWidthExpression.VarLenReadExpr
.visitValueVectorWriteExpression
(ValueVectorWriteExpression writeExpr, OutputWidthVisitorState state) Records a variable width write expression.visitVarDecimalConstant
(ValueExpressions.VarDecimalExpression varDecimalExpression, OutputWidthVisitorState state) visitVarLenReadExpr
(OutputWidthExpression.VarLenReadExpr varLenReadExpr, OutputWidthVisitorState state) Converts theOutputWidthExpression.VarLenReadExpr
to aOutputWidthExpression.FixedLenExpr
by getting the size for the corresponding column from the RecordBatchSizer.Methods inherited from class org.apache.drill.exec.expr.AbstractExecExprVisitor
visitUnknown
Methods inherited from class org.apache.drill.common.expression.visitors.AbstractExprVisitor
visitAnyValueExpression, visitBooleanConstant, visitBooleanOperator, visitCastExpression, visitConvertExpression, visitDateConstant, visitDecimal18Constant, visitDecimal28Constant, visitDecimal38Constant, visitDecimal9Constant, visitDoubleConstant, visitFloatConstant, visitFunctionCall, visitIntConstant, visitIntervalDayConstant, visitIntervalYearConstant, visitLongConstant, visitNullExpression, visitParameter, visitSchemaPath, visitTimeConstant, visitTimeStampConstant, visitTypedFieldExpr
-
Constructor Details
-
OutputWidthVisitor
public OutputWidthVisitor()
-
-
Method Details
-
visitVarDecimalConstant
public OutputWidthExpression visitVarDecimalConstant(ValueExpressions.VarDecimalExpression varDecimalExpression, OutputWidthVisitorState state) throws RuntimeException - Specified by:
visitVarDecimalConstant
in interfaceExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Overrides:
visitVarDecimalConstant
in classAbstractExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitIfExpression
public OutputWidthExpression visitIfExpression(IfExpression ifExpression, OutputWidthVisitorState state) throws RuntimeException Records theIfExpression
as aOutputWidthExpression.IfElseWidthExpr
. IfElseWidthExpr will be reduced to aOutputWidthExpression.FixedLenExpr
by taking the max of the if-expr-width and the else-expr-width.- Specified by:
visitIfExpression
in interfaceExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Overrides:
visitIfExpression
in classAbstractExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitFunctionHolderExpression
public OutputWidthExpression visitFunctionHolderExpression(FunctionHolderExpression holderExpr, OutputWidthVisitorState state) throws RuntimeException Handles aFunctionHolderExpression
. Functions that produce fixed-width output are trivially converted to aOutputWidthExpression.FixedLenExpr
. For functions that produce variable width output, the output width calculator annotation is looked-up and recorded in aOutputWidthExpression.FunctionCallExpr
. This calculator will later be used to convert the FunctionCallExpr to aOutputWidthExpression.FixedLenExpr
expression- Specified by:
visitFunctionHolderExpression
in interfaceExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Overrides:
visitFunctionHolderExpression
in classAbstractExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitValueVectorWriteExpression
public OutputWidthExpression visitValueVectorWriteExpression(ValueVectorWriteExpression writeExpr, OutputWidthVisitorState state) throws RuntimeException Records a variable width write expression. This will be converted to aOutputWidthExpression.FixedLenExpr
expression by walking the tree of expression attached to the write expression.- Overrides:
visitValueVectorWriteExpression
in classAbstractExecExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitValueVectorReadExpression
public OutputWidthExpression visitValueVectorReadExpression(ValueVectorReadExpression readExpr, OutputWidthVisitorState state) throws RuntimeException Records a variable width read expression as aOutputWidthExpression.VarLenReadExpr
. This will be converted to aOutputWidthExpression.FixedLenExpr
expression by getting the size for the corresponding column from theRecordBatchSizer
.- Overrides:
visitValueVectorReadExpression
in classAbstractExecExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitQuotedStringConstant
public OutputWidthExpression visitQuotedStringConstant(ValueExpressions.QuotedString quotedString, OutputWidthVisitorState state) throws RuntimeException - Specified by:
visitQuotedStringConstant
in interfaceExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Overrides:
visitQuotedStringConstant
in classAbstractExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitUnknown
public OutputWidthExpression visitUnknown(LogicalExpression logicalExpression, OutputWidthVisitorState state) Description copied from class:AbstractExprVisitor
Handles implementation-specific expressions not known to the visitor structure. Since there are no "visitFoo" methods for these "unknown" expressions, subclassses should use the functionally-equivalentinstanceof
approach to parse out these "unknown" expressions.- Specified by:
visitUnknown
in interfaceExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Overrides:
visitUnknown
in classAbstractExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException>
-
visitNullConstant
public OutputWidthExpression visitNullConstant(TypedNullConstant nullConstant, OutputWidthVisitorState state) throws RuntimeException - Specified by:
visitNullConstant
in interfaceExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Overrides:
visitNullConstant
in classAbstractExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitFixedLenExpr
public OutputWidthExpression visitFixedLenExpr(OutputWidthExpression.FixedLenExpr fixedLenExpr, OutputWidthVisitorState state) throws RuntimeException - Overrides:
visitFixedLenExpr
in classAbstractExecExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitVarLenReadExpr
public OutputWidthExpression visitVarLenReadExpr(OutputWidthExpression.VarLenReadExpr varLenReadExpr, OutputWidthVisitorState state) throws RuntimeException Converts theOutputWidthExpression.VarLenReadExpr
to aOutputWidthExpression.FixedLenExpr
by getting the size for the corresponding column from the RecordBatchSizer.- Overrides:
visitVarLenReadExpr
in classAbstractExecExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitFunctionCallExpr
public OutputWidthExpression visitFunctionCallExpr(OutputWidthExpression.FunctionCallExpr functionCallExpr, OutputWidthVisitorState state) throws RuntimeException Converts aOutputWidthExpression.FunctionCallExpr
to aOutputWidthExpression.FixedLenExpr
by passing the the args of the function to the width calculator for this function.- Overrides:
visitFunctionCallExpr
in classAbstractExecExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-
visitIfElseWidthExpr
public OutputWidthExpression visitIfElseWidthExpr(OutputWidthExpression.IfElseWidthExpr ifElseWidthExpr, OutputWidthVisitorState state) throws RuntimeException Converts theOutputWidthExpression.IfElseWidthExpr
to aOutputWidthExpression.FixedLenExpr
by taking the max of the if-expr-width and the else-expr-width.- Overrides:
visitIfElseWidthExpr
in classAbstractExecExprVisitor<OutputWidthExpression,
OutputWidthVisitorState, RuntimeException> - Throws:
RuntimeException
-