cashmand commented on code in PR #50270:
URL: https://github.com/apache/spark/pull/50270#discussion_r1999686628


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/variant/VariantExpressionSuite.scala:
##########
@@ -856,6 +858,45 @@ class VariantExpressionSuite extends SparkFunSuite with 
ExpressionEvalHelper {
     val bytes = builder.result().getValue
     checkCast(bytes, StringType,
       "01020304-0506-0708-090a-0b0c0d0e0f10")
+
+    // TimestampNanos
+    // Cast and to_json produce slightly different formats.
+    val timestamps = Seq(
+        ("2024-12-16T10:23:45-08:00", "2024-12-16 10:23:45", "2024-12-16 
10:23:45-08:00"),
+        ("1970-01-01T00:00:00.123456789-08:00", "1970-01-01 
00:00:00.123456789",
+         "1970-01-01 00:00:00.123456789-08:00"),
+        ("2100-12-31T23:59:59.00100-08:00", "2100-12-31 23:59:59.001",
+         "2100-12-31 23:59:59.001-08:00")

Review Comment:
   594 is the total range, so the earliest date is 1970 - 593 / 2 = 1677. I 
added a test for the earliest date.
   
   (It's not quite the earliest timestamp, because 
`TimeUnit.SECONDS.toNanos(instant.getEpochSecond())` in the test truncates if 
it's within a second of the earliest possible nanosecond, which confuses the 
test. It's an issue with the test, not the implementation, and it didn't seem 
worth the complexity of fixing the test just to cover that case.)



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

Reply via email to