viirya commented on a change in pull request #31103:
URL: https://github.com/apache/spark/pull/31103#discussion_r554451555
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala
##########
@@ -304,8 +304,13 @@ case class ExpressionEncoder[T](
StructField(s.name, s.dataType, s.nullable)
})
+ /**
+ * This is used for `ScalaUDF` (see `UDFRegistration`). As the serialization
in `ScalaUDF` is for
+ * individual column, not the whole row, we just take the data type of
vanilla object serializer,
+ * not `serializer` which is transformed somehow.
+ */
def dataTypeAndNullable: Schema = {
- val dataType = if (isSerializedAsStruct) schema else schema.head.dataType
+ val dataType = objSerializer.dataType
Schema(dataType, objSerializer.nullable)
Review comment:
Okay, looks putting it in `UDFRegistration` is better.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]