You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/30 15:05:27 UTC

[GitHub] [spark] xkrogen commented on a change in pull request #32407: [SPARK-35261][SQL] Support static magic method for stateless ScalarFunction

xkrogen commented on a change in pull request #32407:
URL: https://github.com/apache/spark/pull/32407#discussion_r623952435



##########
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:
       Scala doesn't have the concept of truly static methods, right? The equivalent (`object` methods) are actually just instance methods on a singleton.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org