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

 ##########
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
 ##########
 @@ -211,7 +211,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 (targetTypes[i].isArray()) {
+        // only the last type could be variable length argument. All left 
expressions
 
 Review comment:
   Only the last can be a vararg but there can be other array types in between, 
does this pose a problem? Maybe add some unit tests with such cases?

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