Skip to content

Implement Spark-compatible CAST from String to Date #327

Closed

Description

@andygrove

What is the problem the feature request solves?

What is the problem the feature request solves?

We currently delegate to DataFusion when casting from string to date and there are some differences in behavior compared to Spark.

  • Spark supports dates in the format YYYY and YYYY-MM and DataFusion does not
  • Spark supports a trailing T as in 2024-01-01T and DataFusion does not
  • DataFusion doesn't throw an exception for invalid inputs in ANSI mode

Edge cases from fuzz testing:

Input Spark DataFusion
"-0973250" 3251-01-01 null
"-3638-5" 3639-05-01 null

Describe the potential solution

No response

Additional context

No response

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Apr 25, 2024
  2. parthchandra commented on Apr 25, 2024

    @parthchandra
    Contributor

    FWIW, comet cast string to timestamp uses a format string that matches the one used by Spark. It still needs to be massaged for trailing zeroes though.
    Ansi mode was never tried/tested

  3. vidyasankarv commented on Apr 26, 2024

    @vidyasankarv
    Contributor

    Hi @andygrove I would love to work on this. If no one else is working on it.

  4. andygrove commented on Apr 26, 2024

    @andygrove
    MemberAuthor

    Hi @andygrove I would love to work on this. If no one else is working on it.

    Thank you @vidyasankarv that would be awesome! Let me know if you have any questions.

  5. vidyasankarv commented on Apr 29, 2024

    @vidyasankarv
    Contributor

    Hi @andygrove, I am new to rust and open source work in general, but eager to learn and contribute. looking at #335 for time stamp casting which looks similar to my issue. Will keep working on this and get back to you with any questions.

    And thank you for your book on How Query Engines Work - thats what got me interested in apahce data fusion.

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

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions