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: return more understandable error when not grouping by a histogram #37952

Closed
eskibars opened this issue Jan 29, 2019 · 2 comments

Comments

Projects
None yet
5 participants
@eskibars
Copy link
Contributor

commented Jan 29, 2019

Testing on 6.6.0.

Consider using SQL to query for a 1-minute histogram, e.g. across a default metricbeat index (and the default time field, @timestamp).

GET /_xpack/sql?format=txt
{
  "query": """
  SELECT HISTOGRAM("@timestamp", INTERVAL 1 MINUTE) AS h FROM "metricbeat-*" GROUP BY h
  """
}

This correctly returns. However, when omitting GROUP BY ... as in:

GET /_xpack/sql?format=txt
{
  "query": """
  SELECT HISTOGRAM("@timestamp", INTERVAL 1 MINUTE) FROM "metricbeat-*"
  """
}

We get:

{
  "error": {
    "root_cause": [
      {
        "type": "sql_illegal_argument_exception",
        "reason": "Unknown output attribute HISTOGRAM(@timestamp){g->2644358}#2644358"
      }
    ],
    "type": "sql_illegal_argument_exception",
    "reason": "Unknown output attribute HISTOGRAM(@timestamp){g->2644358}#2644358"
  },
  "status": 500
}

We should clean up the error here so it's easier for a user to understand what they've done wrong.

@elasticmachine

This comment has been minimized.

Copy link

commented Jan 29, 2019

@astefan

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2019

master(7.0.0): 6968f09
6.x (6.7.0): 4cf0391
6.6 (6.6.1): d05c24c

@astefan astefan added the v7.0.0 label Feb 4, 2019

@colings86 colings86 added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.