Skip to content

Support unix_date and date_from_unix_date natively #2524

Description

@Sigma-Ma

Is your feature request related to a problem? Please describe.

Auron does not currently support native execution of Spark's unix_date and date_from_unix_date expressions. These expressions fall back to Spark evaluation.

Describe the solution you'd like

Add native support for both functions:

  • unix_date(date) returns an integer day count relative to 1970-01-01.
  • date_from_unix_date(days) converts that day count back to a date.

Preserve Spark's return types and null behavior. Add tests for zero, positive and negative day counts, integer boundaries, and round-trip conversions. Use column inputs in Spark regression tests and verify that both expressions execute natively.

Describe alternatives you've considered

Keep the existing Spark fallback.

Additional context

Both functions were introduced in Spark 3.1.0.

SELECT unix_date(DATE '1970-01-01'); -- 0

SELECT unix_date(DATE '1969-12-31'); -- -1

SELECT date_from_unix_date(0); -- 1970-01-01

SELECT date_from_unix_date(-1); -- 1969-12-31

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions