MaxGekk commented on code in PR #50194: URL: https://github.com/apache/spark/pull/50194#discussion_r1983987486
########## sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala: ########## @@ -862,7 +862,7 @@ class UDFSuite extends QueryTest with SharedSparkSession { .select(myUdf1(Column("col"))), Row(ArrayBuffer(100))) - val myUdf2 = udf((a: immutable.ArraySeq[Int]) => + val myUdf2 = udf((a: immutable.ArraySeq[Int]) => Review Comment: Are the changes necessary? ########## sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala: ########## @@ -1197,6 +1197,34 @@ class UDFSuite extends QueryTest with SharedSparkSession { Row(Row(null))) } + test("SPARK-51402: Test TimeType in UDF") { + // Regular case + val input = Seq(java.time.LocalDateTime.parse("2021-01-01T00:00:00.000000")).toDF("dateTime") + val plusHour = udf((l: java.time.LocalDateTime) => l.plusHours(1)) + val result = input.select(plusHour($"dateTime").cast(TimeType).as("newTime")) Review Comment: Cast a timestamp to time has not been supported yet, please, use `LocalTime` directly. -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org