-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: Register Spark date_format function #11953
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for meta-velox canceled.
|
We only use one signature of |
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.
Thanks.
Converts `timestamp` to a string in the format specified by `dateFormat`. | ||
|
||
SELECT date_format('2020-01-29', 'yyyy'); -- '2020' | ||
SELECT date_format('2024-05-30 08:00:00', 'yyyy-MM-dd'); -- '2024-05-30' |
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.
I wonder if the patterns of 'dateFormat' are the same between Presto and Spark. If no, we might need separate implementation.
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.
Yes, JodaDateTimeFormatter is used as expected. And it has been validated by Spark UTs.
e543f54
to
8b5adbf
Compare
// supported range. | ||
// date_format and from_unixtime throws VeloxRuntimeError when the | ||
// timestamp is out of the supported range. | ||
"date_format", |
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.
The VeloxRuntimeError
with UNSUPPORTED_INPUT_UNCATCHABLE
code is allowed in the fuzzer test. I wonder if we can throw it in the 'from_unixtime' and 'date_format' to make the fuzzer test work. Seeing details in 8a6ab15.
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.
@rui-mo, just removed this function from fuzzer black list. Please review this pr again.
a838497
to
21d95d1
Compare
|
@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This PR registers the existing
FormatDateTimeFunction
for Spark SQL to use.