You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update to_date udf function to support a consistent set of argument types (#19134)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes#123` indicates that this PR will close issue #123.
-->
- Closes#19120
## Rationale for this change
Improved type support for to_date function.
## What changes are included in this PR?
Code, slt, updated docs.
## Are these changes tested?
Yes
## Are there any user-facing changes?
More types supported.
description = r"Converts a value to a date (`YYYY-MM-DD`).
33
-
Supports strings, integer and double types as input.
35
+
Supports strings, numeric and timestamp types as input.
34
36
Strings are parsed as YYYY-MM-DD (e.g. '2023-07-20') if no [Chrono format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)s are provided.
35
37
Integers and doubles are interpreted as days since the unix epoch (`1970-01-01T00:00:00Z`).
36
38
Returns the corresponding date.
@@ -144,9 +146,42 @@ impl ScalarUDFImpl for ToDateFunc {
Copy file name to clipboardExpand all lines: docs/source/user-guide/sql/scalar_functions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2709,7 +2709,7 @@ Additional examples can be found [here](https://github.com/apache/datafusion/blo
2709
2709
### `to_date`
2710
2710
2711
2711
Converts a value to a date (`YYYY-MM-DD`).
2712
-
Supports strings, integer and double types as input.
2712
+
Supports strings, numeric and timestamp types as input.
2713
2713
Strings are parsed as YYYY-MM-DD (e.g. '2023-07-20') if no [Chrono format](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)s are provided.
2714
2714
Integers and doubles are interpreted as days since the unix epoch (`1970-01-01T00:00:00Z`).
0 commit comments