sunchao commented on a change in pull request #32407:
URL: https://github.com/apache/spark/pull/32407#discussion_r623670089
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2164,24 +2165,30 @@ class Analyzer(override val catalogManager:
CatalogManager)
// may also want to check if the parameter types from the magic method
// match the input type through `BoundFunction.inputTypes`.
val argClasses = inputType.fields.map(_.dataType)
- findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
+ findMethod(scalarFunc, STATIC_MAGIC_METHOD_NAME, argClasses) match {
case Some(_) =>
- val caller = Literal.create(scalarFunc,
ObjectType(scalarFunc.getClass))
- Invoke(caller, MAGIC_METHOD_NAME, scalarFunc.resultType(),
- arguments, returnNullable = scalarFunc.isResultNullable)
+ StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
Review comment:
Ideally we'd want to check if this method is actually static, otherwise
there could be runtime error. However this only works for methods defined in
Java; for Scala seems there is no easy way.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]