AngersZhuuuu commented on a change in pull request #29085:
URL: https://github.com/apache/spark/pull/29085#discussion_r456301933
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/BaseScriptTransformationExec.scala
##########
@@ -87,17 +131,55 @@ trait BaseScriptTransformationExec extends UnaryExecNode {
}
}
}
+
+ private lazy val fieldWriters: Seq[String => Any] = output.map { attr =>
+ val converter =
CatalystTypeConverters.createToCatalystConverter(attr.dataType)
+ attr.dataType match {
+ case StringType => (data: String) => converter(data)
+ case ByteType => (data: String) => converter(data.toByte)
+ case IntegerType => (data: String) => converter(data.toInt)
+ case ShortType => (data: String) => converter(data.toShort)
+ case LongType => (data: String) => converter(data.toLong)
+ case FloatType => (data: String) => converter(data.toFloat)
+ case DoubleType => (data: String) => converter(data.toDouble)
+ case dt: DecimalType => (data: String) => converter(BigDecimal(data))
+ case DateType if conf.datetimeJava8ApiEnabled => (data: String) =>
Review comment:
@maropu Yes, current Script transform with default hive serde only can
support basic data type, cant support array/map/staruct/timestamp etc. Here we
support a simple Default serde that can replace LazySimpleSerde
----------------------------------------------------------------
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]