ihuzenko commented on a change in pull request #1944: DRILL-7503: Refactor the
project operator
URL: https://github.com/apache/drill/pull/1944#discussion_r364210835
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/OutputWidthVisitor.java
##########
@@ -43,238 +43,213 @@
import java.util.ArrayList;
-public class OutputWidthVisitor extends
AbstractExecExprVisitor<OutputWidthExpression, OutputWidthVisitorState,
- RuntimeException> {
-
- @Override
- public OutputWidthExpression visitVarDecimalConstant(VarDecimalExpression
varDecimalExpression,
-
OutputWidthVisitorState state) throws RuntimeException {
-
Preconditions.checkArgument(varDecimalExpression.getMajorType().hasPrecision());
- return new
FixedLenExpr(varDecimalExpression.getMajorType().getPrecision());
- }
-
-
- /**
- *
- * Records the {@link IfExpression} as a {@link IfElseWidthExpr}.
IfElseWidthExpr will be reduced to
- * a {@link FixedLenExpr} by taking the max of the if-expr-width and the
else-expr-width.
- *
- * @param ifExpression
- * @param state
- * @return IfElseWidthExpr
- * @throws RuntimeException
- */
- @Override
- public OutputWidthExpression visitIfExpression(IfExpression ifExpression,
OutputWidthVisitorState state)
- throws
RuntimeException {
- IfExpression.IfCondition condition = ifExpression.ifCondition;
- LogicalExpression ifExpr = condition.expression;
- LogicalExpression elseExpr = ifExpression.elseExpression;
-
- OutputWidthExpression ifWidthExpr = ifExpr.accept(this, state);
- OutputWidthExpression elseWidthExpr = null;
- if (elseExpr != null) {
- elseWidthExpr = elseExpr.accept(this, state);
- }
- return new IfElseWidthExpr(ifWidthExpr, elseWidthExpr);
+public class OutputWidthVisitor
+ extends AbstractExecExprVisitor<OutputWidthExpression,
+ OutputWidthVisitorState,
+ RuntimeException> {
+
+ @Override
+ public OutputWidthExpression visitVarDecimalConstant(VarDecimalExpression
varDecimalExpression,
+ OutputWidthVisitorState
state) throws RuntimeException {
+
Preconditions.checkArgument(varDecimalExpression.getMajorType().hasPrecision());
+ return new
FixedLenExpr(varDecimalExpression.getMajorType().getPrecision());
+ }
+
+ /**
+ *
Review comment:
```suggestion
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services