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 make_date function #9024

Closed
Omega359 opened this issue Jan 27, 2024 · 3 comments · Fixed by #9040
Closed

Add a make_date function #9024

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

Comments

@Omega359
Copy link
Contributor

Omega359 commented Jan 27, 2024

Is your feature request related to a problem or challenge?

Currently there isn't a way to make a date from separate component fields without doing a fair bit of work along the lines of:

arrow_cast(to_timestamp_seconds(concat(col(date_year), '-', lpad(arrow_cast(col(date_month), 'Utf8'), 2, '0'), '-', lpad(arrow_cast(col(date_day), 'Utf8'), 2, '0'), 'T00:00:00.000Z')), 'Date32')

A function with the same signature as the postgresql or spark functions would be a useful addition.

Describe the solution you'd like

A make_date(year, month, day) function that would take expressions for all arguments with a return type of Date32 for dataframes, Date for SQL.

Describe alternatives you've considered

No response

Additional context

No response

@Omega359 Omega359 added the enhancement New feature or request label Jan 27, 2024
@alamb
Copy link
Contributor

alamb commented Jan 27, 2024

A similar request (make interval) is #6951

@Omega359
Copy link
Contributor Author

A similar request (make interval) is #6951

I can work on that one after I complete this one.

@alamb
Copy link
Contributor

alamb commented Jan 28, 2024

Thanks @Omega359 !

BTW I am not sure if you are interested, but #8282 contains a list of tickets we have gathered relating to date/time issues

Omega359 added a commit to Omega359/arrow-datafusion that referenced this issue Jan 29, 2024
Omega359 added a commit to Omega359/arrow-datafusion that referenced this issue Jan 29, 2024
alamb pushed a commit that referenced this issue Jan 30, 2024
* Add a make_date function #9024

* Fixed error message #9024

* minor typo fix.
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