danny0405 commented on a change in pull request #1083: [CALCITE-2889] 
IndexOutOfBoundsException thrown if targetTypes[] contains varargs
URL: https://github.com/apache/calcite/pull/1083#discussion_r285414627
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
 ##########
 @@ -202,7 +202,23 @@ static Expression fromInternal(Expression e, Class<?> 
targetType) {
       List<Expression> expressions) {
     final List<Expression> list = new ArrayList<>();
     for (int i = 0; i < expressions.size(); i++) {
-      list.add(fromInternal(expressions.get(i), targetTypes[i]));
+      if (i == targetTypes.length - 1 && targetTypes[i].isArray()) {
+        // only the last type could be varargs. All left expressions
 
 Review comment:
   Should we consider just `Array` type as var-length here ? Should we 
enumerate all the variable length types ?

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

Reply via email to