Skip to content

SQL: conditions involving date fields with custom format and SQL-generated dates fail #45139

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
astefan opened this issue Aug 2, 2019 · 1 comment · Fixed by #45326
Closed
Assignees
Labels

Comments

@astefan
Copy link
Contributor

astefan commented Aug 2, 2019

For a date field with a custom format like HH:mm yyyy-MM-dd, a simple query like SELECT * FROM test WHERE date > NOW() will fail with an error:

        "root_cause": [
            {
                "type": "parse_exception",
                "reason": "failed to parse date field [2019-08-02T10:42:15.773Z] with format [HH:mm yyyy-MM-dd]: [Text '2019-08-02T10:42:15.773Z' could not be parsed at index 2]"
            }
        ],

Moreover, if a timezone is passed in the request in the {area}/{city} format (for REST - for example "time_zone": "Europe/Paris"), the date SQL generates and places it in the range filter also specifies the {area}/{city} format alongside the offset. The offset should be enough and the area/city is redundant.

        "root_cause": [
            {
                "type": "parse_exception",
                "reason": "failed to parse date field [2019-08-02T12:42:53.804+02:00[Europe/Paris]] with format [HH:mm yyyy-MM-dd]: [Text '2019-08-02T12:42:53.804+02:00[Europe/Paris]' could not be parsed at index 2]"
            }
        ],
@astefan astefan added >bug :Analytics/SQL SQL querying labels Aug 2, 2019
@astefan astefan self-assigned this Aug 2, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

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 a pull request may close this issue.

2 participants