Skip to content
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

Add a to_date function #8987

Closed
Omega359 opened this issue Jan 24, 2024 · 3 comments · Fixed by #9019
Closed

Add a to_date function #8987

Omega359 opened this issue Jan 24, 2024 · 3 comments · Fixed by #9019
Labels
enhancement New feature or request

Comments

@Omega359
Copy link
Contributor

Is your feature request related to a problem or challenge?

In a similar vein to #8886 I believe it would be useful to have a to_date function that mirrors the functionality found in postgresql and spark. The format options however would follow the same pattern as #8886 and use the chrono library's formats (at least for the initial implementation)

Passing a single argument to the function would behave in a similar manner to the to_timestamp function where it was attempt to infer the date from either a number type (inferred as seconds/millis/etc since epoch), a timestamp or a utf8/largeutf8 string. arrow-cast has a parse_date function invoked from the cast from string -> date32 that seems to handle a few common formats that can be documented in the user guide and examples.

The return type of this new function would be Date32 for arrow, Date for SQL.

Describe the solution you'd like

A to_date(expr[,.format_n]) function that can be invoked from a dataframe or via sql in the same manner as to_timestamp.

Describe alternatives you've considered

The basic implementation can likely be done using arrow_cast functionality currently however having a full function would allow for additional formatting options.

Additional context

No response

@Omega359 Omega359 added the enhancement New feature or request label Jan 24, 2024
@Omega359 Omega359 changed the title Implement the to_date function Add a to_date function Jan 24, 2024
@Tangruilin
Copy link
Contributor

May be this can be assigned to me @Omega359 , I am interested on this problem

@Omega359
Copy link
Contributor Author

Feel free to submit a pull request - I haven't started any work on this myself. I have the logic in a UDF however it's not exactly complex.

@Tangruilin
Copy link
Contributor

Please assigned it to me
Thanks @alamb

Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 27, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 30, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 30, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 30, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 31, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 31, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 31, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 31, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 31, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Jan 31, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 1, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 2, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 3, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 19, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 19, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 19, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 25, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 27, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 27, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 27, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 27, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 28, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 28, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 28, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 29, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Tangruilin added a commit to Tangruilin/arrow-datafusion that referenced this issue Feb 29, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
alamb pushed a commit that referenced this issue Feb 29, 2024
Signed-off-by: tangruilin <tang.ruilin@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants