Skip to content

Add a make_date function #9024

Closed
Closed

Description

@Omega359

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

Activity

  1. alamb commented on Jan 27, 2024

    @alamb
    Contributor

    A similar request (make interval) is #6951

  2. Omega359 commented on Jan 27, 2024

    @Omega359
    ContributorAuthor

    A similar request (make interval) is #6951

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

  3. alamb commented on Jan 28, 2024

    @alamb
    Contributor

    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

  4. added a commit that references this issue on Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions