-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29651][SQL] Fix parsing of interval seconds fraction #26313
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
|
Test build #112901 has finished for PR 26313 at commit
|
|
This also might be fixed in #26314, would you please take a look? |
|
Probably, this could be fixed by the new feature proposed by #26314 but tests from this PR and the fix of the existing code are valuable as well, I think. @cloud-fan @dongjoon-hyun WDYT? |
|
The bugs exist in the versions since 2.0, and the fixes can be ported back but the feature in #26314 cannot, I think. |
|
I agree with @MaxGekk . |
|
not related to this PR, but I find |
| } | ||
|
|
||
| private def parseNanos(nanosStr: String, isNegative: Boolean): Long = { | ||
| val alignedStr = if (nanosStr == null) nanosStr else (nanosStr + "000000000").substring(0, 9) |
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.
shall we return 0 immediately if nanosStr is null? It's easier to read than relying on toLongWithRange to return 0.
|
Test build #112907 has finished for PR 26313 at commit
|
|
Test build #112922 has finished for PR 26313 at commit
|
|
Test build #112914 has finished for PR 26313 at commit
|
|
Test build #112923 has finished for PR 26313 at commit
|
|
Test build #112930 has finished for PR 26313 at commit
|
|
The failure #26313 (comment) is not related to the changes, it seems |
|
jenkins, retest this, please |
|
Yes. +1 for @cloud-fan 's suggestion. Originally, I thought it's natural, but @cloud-fan 's suggestion sounds more practical.
|
Let's discuss this there: https://issues.apache.org/jira/browse/SPARK-29671 |
|
Test build #112959 has finished for PR 26313 at commit
|
|
thanks, merging to master! |
|
Should I back port this on 2.4? |
|
yes, please send a backport PR, thanks! |
|
Here is the back port to 2.4 #26355 |
What changes were proposed in this pull request?
In the PR, I propose to extract parsing of the seconds interval units to the private method
parseNanosinIntervalUtilsand modify the code to correctly parse the fractional part of the seconds unit of intervals in the cases:Why are the changes needed?
The changes are needed to fix the issues:
The correct result must be
interval 10 seconds 123 milliseconds 456 microsecondsbut the whole interval should be negated, and the result must be
interval -10 seconds -123 milliseconds -456 microseconds, taking into account the truncation to microseconds.Does this PR introduce any user-facing change?
Yes. After changes:
How was this patch tested?
By existing and new tests in
ExpressionParserSuite.