Martijn Visser created FLINK-41476:
--------------------------------------

             Summary: Calling a procedure with primitive varargs fails with 
ArrayStoreException
                 Key: FLINK-41476
                 URL: https://issues.apache.org/jira/browse/FLINK-41476
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: Martijn Visser


Calling a procedure whose call method takes primitive varargs fails. For a 
procedure with call(ProcedureContext context, double... d), CALL p(1.5e0, 
2.5e0) fails with:

{code}
java.lang.ArrayStoreException: arraycopy: type mismatch: can not copy object 
array[] into double[]
{code}

PlannerCallProcedureOperation#invokeCallMethod copies the converted arguments 
into the varargs array with System.arraycopy, which only works for object 
arrays. The same happens when the class also has call(ProcedureContext, 
Integer, Integer): CALL p(1, 2) picks the varargs method instead of the exact 
match and fails the same way.

We should fill primitive varargs element by element, and prefer a fixed-arity 
method when one matches.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to