-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-33769][SQL] Improve the next-day function of the sql component to deal with Column type #30761
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
correct unit test of the next-day function add unit test of the next-day function
074b66f to
52f4213
Compare
|
cc @HyukjinKwon |
| * "Wed", "Thu", "Fri", "Sat", "Sun" | ||
| * @return A date, or null if `date` was a string that could not be cast to a date or if | ||
| * `dayOfWeek` was an invalid value | ||
| * @group datetime_funcs |
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.
Can you add @since 3.2.0?
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.
done
|
ok to test |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #132785 has finished for PR 30761 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Merged to master. |
|
Test build #132815 has finished for PR 30761 at commit
|
What changes were proposed in this pull request?
The proposition of this pull request is described in this JIRA ticket: https://issues.apache.org/jira/browse/SPARK-33769
It proposes to improve the next-day function of the sql component to deal with Column type for the parameter dayOfWeek.
Why are the changes needed?
It makes this functionality easier to use.
Actually the signature of this function is:
It accepts the dayOfWeek parameter as a String. However in some cases, the dayOfWeek is in a Column, so a different value for each row of the dataframe.
A current workaround is to use the NextDay function like this:
The proposition is to add another signature for this function:
In fact it is already the case for some other functions in this scala object, exemple:
or
This pull request is the same idea for the function next_day.
Does this PR introduce any user-facing change?
Yes
With this pull request, users of spark will have a new signature of the function:
But the existing function signature should still work:
So this change should be retrocompatible.
How was this patch tested?
The unit tests of the next_day function has been enhanced.
It tests the dayOfWeek parameter both as String and Column.
I also added a test case for the existing signature where the dayOfWeek is a non valid String. This should return null.