-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
SQL: implicit CASTing between DATEs and DATETIMEs #49379
Labels
Comments
Pinging @elastic/es-search (:Search/SQL) |
matriv
added a commit
to matriv/elasticsearch
that referenced
this issue
Feb 10, 2020
Make the parsing of date more lenient - as an escaped literal: `{d '2020-02-10[[T| ]10:20[:30][.123456789][tz]]'}` - cast a string to a date: `CAST(2020-02-10[[T| ]10:20[:30][.123456789][tz]]' AS DATE)` Closes: elastic#49379
matriv
added a commit
that referenced
this issue
Feb 10, 2020
Make the parsing of date more lenient - as an escaped literal: `{d '2020-02-10[[T| ]10:20[:30][.123456789][tz]]'}` - cast a string to a date: `CAST(2020-02-10[[T| ]10:20[:30][.123456789][tz]]' AS DATE)` Closes: #49379
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a hard CASTing rule for DATEs and DATETIMEs, ie
CAST(CAST(date AS STRING) AS DATE)
will fail withSqlIllegalArgumentException[cannot cast [2004-06-04T00:00:00.000Z] to [date]: Text '2004-06-04T00:00:00.000Z' could not be parsed, unparsed text found at index 10]
because a date and a time is not actually a date.Should we loosen this hard rule for DATEs and DATETIMEs? Should we do implicit CASTing?
The text was updated successfully, but these errors were encountered: