-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-35771][SQL][FOLLOWUP] IntervalUtils.toYearMonthIntervalString should consider the case year-month type is casted as month type #32982
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
Conversation
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #140029 has finished for PR 32982 at commit
|
MaxGekk
left a comment
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.
+1, LGTM. Merging to master.
Thank you @sarutak , and @HyukjinKwon for your review.
|
@MaxGekk BTW, what do you think day-time should be? One option would be to compromise the ANSI compliance only for the string representation of such types like RDBMSs does, and represent like |
I think the restriction of 0..23 for hours is applicable when it is in middle. But if the field is the start field, its range is restricted either by precision, see SQL standard rules: We can a confirmation of this at the section 4.6.3: In our case |
I think it does. For example, |
|
O.K, the standard says as follows. So, the first field seems to be constrained only by the number of digit. Thanks. |

What changes were proposed in this pull request?
This PR fixes an issue that
IntervalUtils.toYearMonthIntervalStringdoesn't consider the case that year-month interval type is casted as month interval type.If a year-month interval data is casted as month interval, the value of the year is multiplied by
12and added to the value of month. For example,INTERVAL '1-2' YEAR TO MONTHwill beINTERVAL '14' MONTHif it's casted.If this behavior is intended, it's stringified to be
'INTERVAL 14' MONTHbut currently, it will beINTERVAL '2' MONTHWhy are the changes needed?
It's a bug if the behavior of cast is intended.
Does this PR introduce any user-facing change?
No, because this feature is not released yet.
How was this patch tested?
Modified the tests added in SPARK-35771 (#32924).