arina-ielchiieva commented on a change in pull request #1617: DRILL-6533: Allow 
using literal values in functions which expect FieldReader instead of 
ValueHolder
URL: https://github.com/apache/drill/pull/1617#discussion_r250153154
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/interpreter/InterpreterEvaluator.java
 ##########
 @@ -307,36 +317,47 @@ public ValueHolder 
visitFunctionHolderExpression(FunctionHolderExpression holder
 
       DrillSimpleFuncHolder holder = (DrillSimpleFuncHolder) 
holderExpr.getHolder();
 
-      ValueHolder [] args = new ValueHolder [holderExpr.args.size()];
+      // function arguments may have different types:
+      // usually ValueHolder inheritors but sometimes FieldReader ones
+      Object[] args = new Object[holderExpr.args.size()];
       for (int i = 0; i < holderExpr.args.size(); i++) {
-        args[i] = holderExpr.args.get(i).accept(this, inIndex);
+        ValueHolder valueHolder = holderExpr.args.get(i).accept(this, inIndex);
+        args[i] = valueHolder;
 
 Review comment:
   Maybe it is better to define argument in the variable and then in the end 
set it `args`?

----------------------------------------------------------------
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

Reply via email to