vlsi opened a new pull request, #5326:
URL: https://github.com/apache/calcite/pull/5326

   Calling `apply()` on the function that `FunctionExpression.getFunction()` 
returns for a lambda with no parameters throws `java.lang.NullPointerException: 
Cannot read the array length because "args" is null` from 
`FunctionExpression.lambda$compile$0`. That function is a 
`java.lang.reflect.Proxy`, and for an interface method with no arguments, such 
as `Function0.apply()`, the JDK calls the proxy's `InvocationHandler` with a 
null argument array 
([InvocationHandler.invoke](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/reflect/InvocationHandler.html#invoke(java.lang.Object,java.lang.reflect.Method,java.lang.Object%5B%5D))).
 The handler now passes an empty array to `Invokable.dynamicInvoke` when it 
receives null.
   
   `ExpressionTest.testLambdaWithoutParametersViaGetFunction` (new) fails with 
that NullPointerException without the fix and passes with it.
   
   The fix and the test come from CALCITE-7736 (#5213), which carries the same 
change inside the nullness migration; this PR lets it land on its own.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to