cloud-fan commented on a change in pull request #32070:
URL: https://github.com/apache/spark/pull/32070#discussion_r608314737
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -818,6 +818,31 @@ abstract class CastSuiteBase extends SparkFunSuite with
ExpressionEvalHelper {
checkConsistencyBetweenInterpretedAndCodegen(
(child: Expression) => Cast(child, StringType), YearMonthIntervalType)
}
+
+ test("SPARK-34668: cast day-time interval to string") {
+ Seq(
+ Duration.ZERO -> "0 0:0:0",
+ Duration.of(1, ChronoUnit.MICROS) -> "0 0:0:0.000001",
+ Duration.ofMillis(-1) -> "-0 0:0:0.001",
+ Duration.ofMillis(1234) -> "0 0:0:1.234",
+ Duration.ofSeconds(-59).minus(999999, ChronoUnit.MICROS) -> "-0
0:0:59.999999",
+ Duration.ofMinutes(30).plusMillis(10) -> "0 0:30:0.01",
+ Duration.ofHours(-23).minusSeconds(59) -> "-0 23:0:59",
Review comment:
For times, I think it's more common to always have 2 digits. Have we
checked with other databases?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]