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_r222601096
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
##########
@@ -590,109 +635,84 @@ private HoldingContainer
visitReturnValueExpression(ReturnValueExpression e, Cla
public HoldingContainer visitQuotedStringConstant(QuotedString e,
ClassGenerator<?> generator)
throws RuntimeException {
MajorType majorType = e.getMajorType();
- JBlock setup = generator.getBlock(BlockType.SETUP);
JType holderType = generator.getHolderType(majorType);
JVar var = generator.declareClassField("string", holderType);
- JExpression stringLiteral = JExpr.lit(e.value);
- JExpression buffer =
generator.getMappingSet().getIncoming().invoke("getContext").invoke("getManagedBuffer");
- setup.assign(var,
-
generator.getModel().ref(ValueHolderHelper.class).staticInvoke("getVarCharHolder").arg(buffer).arg(stringLiteral));
- return new HoldingContainer(majorType, var, null, null);
+ generator.declareSetterMethod(
+ var,
+ buffer -> ValueHolderHelper.getVarCharHolder(buffer, e.value));
Review comment:
Please replace `e.value` with `e.getString()`.
----------------------------------------------------------------
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