-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Queries with date filters in the format 'yyyymmdd' give an error #7465
Comments
Without delimiters how can a parser distinguish between dd-mm-yyyy or yyyy-mm-dd? I'm very surprised postgres supports this and would be somewhat inclined not to copy this... Is there some particular use case for why you want this functionality? |
Not specifically. I was querying a date column and realised it didn't work the same as postgres did. I assumed DataFusion was intended to support postgres-esque queries thats why I raised this as an issue. |
When there isn't delimiters, '20200101' will be treated as format Same above, '200101' will be treated as format Both
ISO standard does not permit MMDDYYYY, MMYYYYDD or any other unapproved combination to eliminate any confusion. |
Another option here might be to implement the two argument for of |
@alamb . Maybe I can try to fix it. |
Thank you @Tangruilin |
Arrow has this function: https://docs.rs/arrow/latest/arrow/compute/kernels/cast_utils/fn.string_to_datetime.html You could look at how it uses |
It is actually https://docs.rs/arrow-cast/47.0.0/src/arrow_cast/parse.rs.html#571 that would need modification. It should be a relatively straightforward case of adding an additional match case |
@alamb Maybe you can assign this issue to me. |
Otherwise I can't find this issue well
|
I have assigned this issue to you, thanks @Tangruilin |
I have already fix this in arrow,this issue can be closed |
Describe the bug
Hi there. When running queries with date filters that are in the format
'yyyymmdd'
, DataFusion throws an error. This is valid Postgres syntax. However dates in the format'yyyy-mm-dd'
succeed. Both are valid postgres syntax.For both queries below, both are valid postgres syntax however:
To Reproduce
For a date column run a query with the date in string format
'yyyymmdd'
as shown belowError thrown is
Expected behavior
This should return the correct result and not fail
Additional context
No response
The text was updated successfully, but these errors were encountered: