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

    https://github.com/apache/spark/pull/20751#discussion_r172570633
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
 ---
    @@ -1154,8 +1154,18 @@ case class CreateExternalRow(children: 
Seq[Expression], schema: StructType)
     case class EncodeUsingSerializer(child: Expression, kryo: Boolean)
       extends UnaryExpression with NonSQLExpression {
     
    -  override def eval(input: InternalRow): Any =
    -    throw new UnsupportedOperationException("Only code-generated 
evaluation is supported")
    +  override def eval(input: InternalRow): Any = {
    +    val obj = child.eval(input)
    +    if (obj == null) return null
    +
    +    val conf = Option(SparkEnv.get).map(_.conf).getOrElse(new SparkConf)
    +    val serializer = if (kryo) {
    --- End diff --
    
    If I am not mistaken the code generated version adds the serializer 
instance to classes immutable state, so there is not need.


---

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

Reply via email to