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

    https://github.com/apache/spark/pull/20753#discussion_r177631719
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
 ---
    @@ -184,12 +217,21 @@ case class StaticInvoke(
         returnNullable: Boolean = true) extends InvokeLike {
     
       val objectName = staticObject.getName.stripSuffix("$")
    +  val cls = if (staticObject.getName == objectName) {
    +    staticObject
    +  } else {
    +    Utils.classForName(objectName)
    +  }
     
       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.")
    +  lazy val argClasses = ScalaReflection.expressionJavaClasses(arguments)
    --- End diff --
    
    We need to make this `lazy`. This is because `StaticInvoke` is also called 
before `dataType` is resolved.
    For example, `test.org.apache.spark.sql.JavaDatasetSuite.test` was failed 
without `lazy`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to