Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/20753#discussion_r177411749
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
---
@@ -188,8 +189,30 @@ case class StaticInvoke(
override def nullable: Boolean = needNullCheck || returnNullable
override def children: Seq[Expression] = arguments
- override def eval(input: InternalRow): Any =
- throw new UnsupportedOperationException("Only code-generated
evaluation is supported.")
+ override def eval(input: InternalRow): Any = {
+ val args = arguments.map(e => e.eval(input).asInstanceOf[Object])
+ val argClasses = ScalaReflection.expressionJavaClasses(arguments)
+ val cls = if (staticObject.getName == objectName) {
+ staticObject
+ } else {
+ Utils.classForName(objectName)
+ }
+ val method = cls.getDeclaredMethod(functionName, argClasses : _*)
--- End diff --
Why are we resolving this during evaluation, shouldn't we be able to
determine this statically?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]