vinodkc commented on code in PR #53320:
URL: https://github.com/apache/spark/pull/53320#discussion_r3503369980
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/TimeExpressionsSuite.scala:
##########
@@ -666,4 +666,66 @@ class TimeExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper {
val timeVal = TimeFromSeconds(Literal(secondsValue))
checkEvaluation(TimeToMicros(timeVal), 14500000L)
}
+
+ test("TimeFormat - foldable and non-foldable formats with codegen") {
+ val time = localTime(14, 30, 45, 123456)
+ val timeLit = Literal(time, TimeType())
+
+ // Foldable format - formatter cached at planning time
+ val foldableExpr = TimeFormat(timeLit, Literal("HH:mm:ss"))
+ checkEvaluation(foldableExpr, "14:30:45")
+ checkEvaluation(
+ TimeFormat(Literal(localTime(9, 5, 0), TimeType()), Literal("hh:mm:ss
a")),
+ "09:05:00 AM")
+ checkEvaluation(
+ TimeFormat(timeLit, Literal("HH:mm:ss.SSSSSS")),
Review Comment:
Added a `SSSSSSSSS` (9-digit) test case with nanosecond precision.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]