vvysotskyi commented on a change in pull request #1481: DRILL-6763: Codegen
optimization of SQL functions with constant values
URL: https://github.com/apache/drill/pull/1481#discussion_r222597944
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
##########
@@ -265,72 +266,116 @@ public HoldingContainer visitSchemaPath(SchemaPath
path, ClassGenerator<?> gener
throw new UnsupportedOperationException("All schema paths should have
been replaced with ValueVectorExpressions.");
}
+ private HoldingContainer createHoldingContainer(MajorType majorType, JVar
var) {
+ JFieldRef outputSet = null;
+ if (majorType.getMode() == TypeProtos.DataMode.OPTIONAL) {
+ outputSet = var.ref("isSet");
+ }
+ return new HoldingContainer(majorType, var, var.ref("value"), outputSet);
+ }
+
@Override
public HoldingContainer visitLongConstant(LongExpression e,
ClassGenerator<?> generator) throws RuntimeException {
- HoldingContainer out = generator.declare(e.getMajorType());
- generator.getEvalBlock().assign(out.getValue(), JExpr.lit(e.getLong()));
- return out;
+ MajorType majorType = e.getMajorType();
+ JType holderType = generator.getHolderType(majorType);
Review comment:
Common logic from these methods can be moved to the separate one.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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