cloud-fan commented on a change in pull request #32949:
URL: https://github.com/apache/spark/pull/32949#discussion_r667058061
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala
##########
@@ -698,33 +724,55 @@ class ExpressionParserSuite extends AnalysisTest {
// Single Intervals.
val forms = Seq("", "s")
val values = Seq("0", "10", "-7", "21")
- Seq("year", "month", "week", "day", "hour", "minute", "second",
"millisecond", "microsecond")
- .foreach { unit =>
+
+ ymIntervalUnits.foreach { unit =>
+ forms.foreach { form =>
+ values.foreach { value =>
+ val expected = ymIntervalLiteral(unit, value)
+ checkIntervals(s"$value $unit$form", expected)
+ checkIntervals(s"'$value' $unit$form", expected)
+ }
+ }
+ }
+
+ dtIntervalUnits.foreach { unit =>
+ forms.foreach { form =>
+ values.foreach { value =>
+ val expected = dtIntervalLiteral(unit, value)
+ checkIntervals(s"$value $unit$form", expected)
+ checkIntervals(s"'$value' $unit$form", expected)
+ }
+ }
+ }
+
+ withSQLConf(SQLConf.LEGACY_INTERVAL_ENABLED.key -> "true") {
+ (ymIntervalUnits ++ dtIntervalUnits).foreach { unit =>
forms.foreach { form =>
values.foreach { value =>
- val expected = intervalLiteral(unit, value)
+ val expected = legacyIntervalLiteral(unit, value)
checkIntervals(s"$value $unit$form", expected)
checkIntervals(s"'$value' $unit$form", expected)
}
}
}
- // Hive nanosecond notation.
- checkIntervals("13.123456789 seconds", intervalLiteral("second",
"13.123456789"))
- checkIntervals(
- "-13.123456789 second",
- Literal(new CalendarInterval(
- 0,
- 0,
- DateTimeTestUtils.secFrac(-13, -123, -456))))
- checkIntervals(
- "13.123456 second",
- Literal(new CalendarInterval(
- 0,
- 0,
- DateTimeTestUtils.secFrac(13, 123, 456))))
- checkIntervals("1.001 second",
- Literal(IntervalUtils.stringToInterval("1 second 1 millisecond")))
+ // Hive nanosecond notation.
+ checkIntervals("13.123456789 seconds", legacyIntervalLiteral("second",
"13.123456789"))
Review comment:
`interval 13.123456789 seconds` returns the legacy interval not day-time
interval?
--
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]