Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Can't compute sql sub-queries #1109

Open
jerome73 opened this issue May 4, 2021 · 1 comment
Open

Can't compute sql sub-queries #1109

jerome73 opened this issue May 4, 2021 · 1 comment
Labels
enhancement New feature or request SQL

Comments

@jerome73
Copy link

jerome73 commented May 4, 2021

Hello,

I would like to compute percent metrics using the _sql api.
To do so I run this type of query:

POST _opendistro/_sql
{
  "query" : "SELECT count(*)/(SELECT count(*) FROM ml_algos), algo_version FROM ml_algos GROUP BY algo_version"
}```

But this returns the following error:

```json
{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "unsupported expr: com.alibaba.druid.sql.ast.statement.SQLSelect@1d60737e",
    "type": "RuntimeException"
  },
  "status": 503
}

FYI this type of query runs well against db like sqlite.
Is this supported by opendistro sql plugin ?

@dai-chen
Copy link
Member

dai-chen commented May 13, 2021

Hi @jerome73 , thanks for reporting the issue! Unfortunately, this is not supported yet. For now only subqueries in FROM and WHERE can be supported. Please check out our doc: https://github.com/opendistro-for-elasticsearch/sql/blob/develop/docs/user/dql/complex.rst#subquery

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request SQL
Projects
None yet
Development

No branches or pull requests

2 participants