[
https://issues.apache.org/jira/browse/CALCITE-2889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16847007#comment-16847007
]
Julian Hyde commented on CALCITE-2889:
--------------------------------------
I've tried to modify UdfTest to reproduce this problem, but can't. We don't
support UDFs based on methods with varargs arguments. We could, but that would
be a different JIRA case.
As the PR stands, it changes Calcite code for some internal case. It actually
changes the specification of the {{fromInternal}} method. The method's behavior
is currently so obvious that the method doesn't need javadoc. But if we
accepted this change, the method would need javadoc.
If the last argument of a method is an array, it is not necessarily a varargs
method. This code makes that false assumption.
This PR is half of a feature (the other half of which is buried in someone
else's code). We should reject it.
> IndexOutOfBoundsException in EnumUtils#fromInternal when handling methods
> with varargs
> --------------------------------------------------------------------------------------
>
> Key: CALCITE-2889
> URL: https://issues.apache.org/jira/browse/CALCITE-2889
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Rui Wang
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.20.0
>
> Time Spent: 4h 10m
> Remaining Estimate: 0h
>
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java#L210
> If "targetTypes" is from "method.getParameterTypes()" and if method's
> signature is "func(stirng ... args)", then "targetTypes" will contain one
> type "String[].class", but "expressions" could contain one than one element,
> so it throws IndexOutOfBoundsException.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)