Repository navigation
fix: truncate per-row date_trunc formats with the literal-format kernel #6354
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
81a3785
fix: truncate per-row date_trunc formats with the literal-format kernel
andygrove bbac449
Merge remote-tracking branch 'apache/main' into rework-6354
andygrove 6964f92
fix: pass the SECOND/MILLISECOND overflow policy through the format-c…
andygrove 97728ba
fix: handle a NULL format and a literal timestamp with a format colum…
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
This fixes a NULL format coming from a column. Two sibling shapes still fall through to the
_ =>arm below, though, and fail withInvalid input to function TimestampTrunc. Expected (Timestamp, Utf8)underallowIncompatible=true:date_trunc(NULL, ts), where Spark returns NULLdate_trunc(fmt, TIMESTAMP '2024-01-15 18:30:45')I reproduced both by evaluating
TimestampTruncExprwithLiteral(Utf8(None))as the format and with aTimestampMicrosecondscalar as the child. Could you handle them here as well? AScalar(Utf8(None))format can return a NULL array of the input's length. A scalar timestamp can be expanded withto_array_of_size(formats.len())before callingtimestamp_trunc_array_fmt_dyn.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 in 97728ba. A NULL literal format now returns NULL: an array of the input's length, or a NULL scalar when the timestamp is a scalar too. A literal timestamp with a format column is expanded with
to_array_of_sizeand goes throughtimestamp_trunc_array_fmt_dyn.null_literal_format_gives_nullandliteral_timestamp_with_a_format_columncover both.