Repository navigation
fix(spark): accept STRING and TIMESTAMP start dates in next_day - #26127
Open
harsh-ande wants to merge 2 commits into
Open
harsh-ande wants to merge 2 commits into
harsh-ande wants to merge 2 commits into
Conversation
Signed-off-by: Harsh Ande <harsh.vardhan.ande@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Spark's
NextDaycasts its first argument to DATE, sonext_day('2015-07-23', 'Mon')andnext_day(TIMESTAMP '2015-07-23 12:12:12', 'Mon')both work.datafusion-sparkdeclaredExact(Date32, Utf8)and failed at planning for STRING and TIMESTAMP inputs.What changes are included in this PR?
next_daynow uses a coercible signature: the first argument is implicitly cast to DATE from STRING or TIMESTAMP, and the day-of-week is any string type (numeric is still coerced to string).next_day.slt, three existingquery errorexpectations changed to the new planner messages (arity and non-date first argument), and the unparseable-string case now returns a cast error. They still fail at planning or execution as before.What is the testing strategy for this PR?
New cases in
spark/datetime/next_day.slt: string, string with a time part, timestamp literal, string column with NULL, timestamp column, andLargeUtf8/Utf8Viewday-of-week. I compared the expected results withpyspark==4.0.0, ANSI on and off.Are there any user-facing changes?
next_dayaccepts more argument types. No API changes.Known limitations / unknowns