Skip to content
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: incorrect DATE format when converting and GROUPing BY #46090

Closed
bpintea opened this issue Aug 28, 2019 · 2 comments · Fixed by #46574
Closed

SQL: incorrect DATE format when converting and GROUPing BY #46090

bpintea opened this issue Aug 28, 2019 · 2 comments · Fixed by #46574
Assignees
Labels

Comments

@bpintea
Copy link
Contributor

bpintea commented Aug 28, 2019

ES/SQL will return a DATETIME value (instead of a DATE) when GROUP BY is applied:
SELECT {fn CONVERT("@timestamp", SQL_DATE)} FROM kibana_sample_data_logs GROUP BY 1
will return:

"columns" : [
    {
      "name" : """CONVERT("@timestamp", SQL_DATE)""",
      "type" : "date"
    }
  ],
  "rows" : [
    [
      "2018-07-22T00:39:02.912Z"
    ],
...

It works as expected without the GROUP BY clause (that is "2018-07-22T00:00:00Z")

@bpintea bpintea added the :Analytics/SQL SQL querying label Aug 28, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@astefan
Copy link
Contributor

astefan commented Sep 16, 2019

master (8.0.0): 3e25db2
7.x (7.5.0): 40e9353
7.4 (7.4.1): 162bffa

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.

3 participants