Skip to content

[SPARK-51497][SQL] Add the default time formatter #50266

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

Closed
wants to merge 2 commits into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Mar 13, 2025

What changes were proposed in this pull request?

In the PR, I propose to add new time formatter DefaultTimeFormatter which behaves like CAST in parsing, and uses the default pattern in formatting.

Why are the changes needed?

The default time formatter can be used in the situation when time pattern is unknown or not set like in text datasources, partition discovery, time expressions and so on.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By running new test:

$ build/sbt "test:testOnly *TimeFormatterSuite"

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Mar 13, 2025
@MaxGekk MaxGekk changed the title [WIP][SQL] Add the default time formatter [WIP][SPARK-51497][SQL] Add the default time formatter Mar 13, 2025
@MaxGekk MaxGekk changed the title [WIP][SPARK-51497][SQL] Add the default time formatter [SPARK-51497][SQL] Add the default time formatter Mar 13, 2025
@MaxGekk MaxGekk marked this pull request as ready for review March 13, 2025 16:14
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @MaxGekk .
Merged to master.

@LuciferYang
Copy link
Contributor

late LGTM, Thank you @MaxGekk

anoopj pushed a commit to anoopj/spark that referenced this pull request Mar 15, 2025
### What changes were proposed in this pull request?
In the PR, I propose to add new time formatter `DefaultTimeFormatter` which behaves like `CAST` in parsing, and uses the default pattern in formatting.

### Why are the changes needed?
The default time formatter can be used in the situation when time pattern is unknown or not set like in text datasources, partition discovery, time expressions and so on.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
By running new test:
```
$ build/sbt "test:testOnly *TimeFormatterSuite"
```

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#50266 from MaxGekk/to_time.

Authored-by: Max Gekk <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants