-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29623][SQL] do not allow multiple unit TO unit statements in interval literal syntax #26285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
66192ce
1aa9a0e
2b79f9c
940c0be
51d9b45
e560cd8
044257d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -644,7 +644,7 @@ class ExpressionParserSuite extends AnalysisTest { | |
|
|
||
| // Non Existing unit | ||
| intercept("interval 10 nanoseconds", | ||
| "no viable alternative at input 'interval 10 nanoseconds'") | ||
| "no viable alternative at input '10 nanoseconds'") | ||
|
|
||
| // Year-Month intervals. | ||
| val yearMonthValues = Seq("123-10", "496-0", "-2-3", "-123-0") | ||
|
|
@@ -679,16 +679,13 @@ class ExpressionParserSuite extends AnalysisTest { | |
| } | ||
|
|
||
| // Unknown FROM TO intervals | ||
| intercept("interval 10 month to second", | ||
| intercept("interval '10' month to second", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from-to unit can only handle string values (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you do write |
||
| "Intervals FROM month TO second are not supported.") | ||
|
|
||
| // Composed intervals. | ||
| checkIntervals( | ||
| "3 months 4 days 22 seconds 1 millisecond", | ||
| Literal(new CalendarInterval(3, 4, 22001000L))) | ||
| checkIntervals( | ||
| "3 years '-1-10' year to month 3 weeks '1 0:0:2' day to second", | ||
| Literal(new CalendarInterval(14, 22, 2 * CalendarInterval.MICROS_PER_SECOND))) | ||
| } | ||
|
|
||
| test("SPARK-23264 Interval Compatibility tests") { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ansi}? (errorCapturingMultiUnitsInterval | errorCapturingUnitToUnitInterval)?is illegal as it can match anything. Note that we need to make(errorCapturingMultiUnitsInterval | errorCapturingUnitToUnitInterval)optional so that we can detectselect intervaland give precise error message.