cloud-fan commented on a change in pull request #27906: [SPARK-31150][SQL]
Parsing seconds fraction with variable length for timestamp
URL: https://github.com/apache/spark/pull/27906#discussion_r393111833
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/util/TimestampFormatterSuite.scala
##########
@@ -92,6 +94,27 @@ class TimestampFormatterSuite extends SparkFunSuite with
SQLHelper with Matchers
}
}
+ test("roundtrip micros -> timestamp -> micros using w/ w/o val-len seconds
fraction") {
+ Seq("yyyy-MM-dd'T'HH:mm:ss.SSSSSS",
"yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXXXX").foreach { pattern =>
+ Seq(
+ -58710115316212000L,
+ -18926315945345679L,
+ -9463427405253013L,
+ -244000001L,
+ 0L,
+ 99628200102030L,
+ 1543749753123456L,
+ 2177456523456789L,
+ 11858049903010203L).foreach { micros =>
+ DateTimeTestUtils.outstandingZoneIds.foreach { zoneId =>
+ val timestamp = TimestampFormatter(pattern, zoneId,
false).format(micros)
Review comment:
This always outputs timestamp string with `0` padded at the end. Does it
test the var-length feature?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]