[
https://issues.apache.org/jira/browse/FLINK-5881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15887126#comment-15887126
]
ASF GitHub Bot commented on FLINK-5881:
---------------------------------------
Github user wuchong commented on a diff in the pull request:
https://github.com/apache/flink/pull/3389#discussion_r103366163
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/ScalarSqlFunction.scala
---
@@ -114,7 +114,9 @@ object ScalarSqlFunction {
inferredTypes.zipWithIndex.foreach {
case (inferredType, i) =>
- operandTypes(i) = inferredType
+ if (operandTypes.length > 0) {
+ operandTypes(i) = inferredType
--- End diff --
If this is a varargs method, the inferredType is an array type. The operand
type should be the component type of the array type, not the array type.
And the `operandTypes.length > 0` condition is still not safe, say the
method is `eval(String a, int... b)` and calling `eval("hello")`, the
`operandTypes`'s length is 1, but `inferredTypes`'s length is 2. An
IndexOutOfBoundsException would be thrown as before.
> ScalarFunction(UDF) should support variable types and variable arguments
> -------------------------------------------------------------------------
>
> Key: FLINK-5881
> URL: https://issues.apache.org/jira/browse/FLINK-5881
> Project: Flink
> Issue Type: Sub-task
> Reporter: Zhuoluo Yang
> Assignee: Zhuoluo Yang
>
> As a sub-task of FLINK-5826. We would like to support the ScalarFunction
> first and make the review a little bit easier.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)