Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20797#discussion_r178670249
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
 ---
    @@ -263,11 +295,21 @@ case class Invoke(
         propagateNull: Boolean = true,
         returnNullable : Boolean = true) extends InvokeLike {
     
    +  lazy val argClasses = ScalaReflection.expressionJavaClasses(arguments)
    +
       override def nullable: Boolean = targetObject.nullable || needNullCheck 
|| returnNullable
       override def children: Seq[Expression] = targetObject +: arguments
     
    -  override def eval(input: InternalRow): Any =
    -    throw new UnsupportedOperationException("Only code-generated 
evaluation is supported.")
    +  override def eval(input: InternalRow): Any = {
    +    val obj = targetObject.eval(input)
    +    if (obj == null) {
    +      // return null if obj is null
    +      null
    +    } else {
    +      val method = obj.getClass.getDeclaredMethod(functionName, argClasses 
: _*)
    --- End diff --
    
    Why are we resolving during evaluation time? This seems to be expensive?


---

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

Reply via email to