KazydubB commented on a change in pull request #1869: DRILL-7254: Read Hive 
union w/o nulls
URL: https://github.com/apache/drill/pull/1869#discussion_r332935357
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFuncHolder.java
 ##########
 @@ -241,7 +241,11 @@ protected void addProtectedBlock(ClassGenerator<?> g, 
JBlock sub, String body, H
             sub.assign(holderVar.ref("reader"), inputVariable.getHolder());
           }
         } else {
-          declare(sub, parameter, inputVariable.getHolder().type(), 
inputVariable.getHolder(), i);
+          JExpression exprToAssign = inputVariable.getHolder();
+          if (parameter.isVarArg() && parameter.isFieldReader() && 
Types.isUnion(inputVariable.getMajorType())) {
+            exprToAssign = exprToAssign.ref("reader");
+          }
+          declare(sub, parameter, inputVariable.getHolder().type(), 
exprToAssign, i);
 
 Review comment:
   `inputVariable.getHolder()` can be replaced to a local variable 
`exprToAssign`.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to