stevomitric commented on code in PR #56593:
URL: https://github.com/apache/spark/pull/56593#discussion_r3435805105


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/DateExpressionsSuite.scala:
##########
@@ -1067,6 +1067,41 @@ class DateExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
       ToUnixTimestamp(Literal("2015-07-24"), Literal("\""), UTC_OPT) :: Nil)
   }
 
+  test("SPARK-57528: unix_timestamp / to_unix_timestamp over 
nanosecond-precision timestamps") {
+    import org.apache.spark.sql.catalyst.util.TimestampNanosTestUtils._
+    // The format is ignored for the timestamp-argument form; the result is 
always whole-second
+    // BIGINT, so the sub-second digits never affect it.
+    val fmt = Literal("yyyy-MM-dd HH:mm:ss")

Review Comment:
   The comment says the format is ignored for the timestamp-argument form, but 
the assertion uses a valid format, so it'd produce the same result whether or 
not the format is read. To actually pin the "format ignored" contract for 
nanos, consider one case with a deliberately invalid format, e.g. 
Literal("not-a-format"), asserting the same whole-second result. (The micros 
path already covers this at DateExpressionsSuite ~`:1021`, so it's a 
low-priority nit.)



-- 
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]

Reply via email to