Skip to content

fix: parsing timestamp with date format#10476

Merged
alamb merged 2 commits intoapache:mainfrom
shanretoo:fix-to-date
May 15, 2024
Merged

fix: parsing timestamp with date format#10476
alamb merged 2 commits intoapache:mainfrom
shanretoo:fix-to-date

Conversation

@shanretoo
Copy link
Copy Markdown
Contributor

@shanretoo shanretoo commented May 13, 2024

Which issue does this PR close?

Closes #10471.

Rationale for this change

Fallback to Parsed::to_naive_date when Parsed::to_naive_datetime_with_offset failed if there is only date in format string.

What changes are included in this PR?

Same as above.

Are these changes tested?

  1. Add unit test
    The timestamp of "2022-01-23" is 1642896000000000000 as written in the test.
Screenshot 2024-05-13 at 1 09 45 PM
  1. Test using datafusion-cli
Screenshot 2024-05-13 at 1 01 13 PM

Are there any user-facing changes?

No

@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 13, 2024

Thank you for the contribution @shanretoo . I started the CI runs for this PR

cc @Omega359

@Omega359
Copy link
Copy Markdown
Contributor

Thanks for the contribution! It would be a nice addition to add the format test to dates.slt

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label May 14, 2024
@shanretoo
Copy link
Copy Markdown
Contributor Author

Added the format test in dates.slt.
@alamb @Omega359

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you very much @shanretoo and @Omega359

@shanretoo
Copy link
Copy Markdown
Contributor Author

It seems I don't have write access to this repo.
Please merge this pr for me, thanks!
@alamb

@alamb alamb merged commit cb88a79 into apache:main May 15, 2024
@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 15, 2024

It seems I don't have write access to this repo. Please merge this pr for me, thanks! @alamb

That is right @shanretoo -- yes only committers can do so (see this page)

I normally try to leave approved PRs open for a while to give anyone else who may want a chance to comment

Thanks again for the contribution 🚀

@alamb
Copy link
Copy Markdown
Contributor

alamb commented May 15, 2024

I made #10532 to try and clarify the PR flow

@shanretoo shanretoo deleted the fix-to-date branch May 16, 2024 01:25
@shanretoo
Copy link
Copy Markdown
Contributor Author

Thank you for your explanation!

findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
* fix parsing timestamp with date format

* add test in dates.slt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

to_date with a date string and format fails with error parsing timestamp

3 participants