-
Notifications
You must be signed in to change notification settings - Fork 179
Description
Describe the bug
In the one of the Power BI usage cases, OS SQL returned an empty response.

The generated query was:
select `bool2`,`C1`
from (
select `bool2`, sum(`int2`) as `C1`
from (
select *
from `calcs`
where `str1` = "BINDING SUPPLIES"
) as `ITBL`
group by `bool2`
) as `ITBL`
where not `C1` is null limit 1000001
Once I simplified it:
select `bool2`,`C1`
from (
select `bool2`, sum(`int2`) as `C1`
from `calcs`
where `str1` = \"BINDING SUPPLIES\"
group by `bool2`
) as `ITBL`
where not `C1` is null limit 1000001
Once I removed the WHERE clause, it returned a valid response.
No errors were reported in the server log.
To Reproduce
Steps to reproduce the behavior:
curl -k -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query" : "select `bool2`, `C1` from (select `bool2`, sum(`int2`) as `C1` from `calcs` where `str1` = \"BINDING SUPPLIES\" group by `bool2`) as `ITBL` where not `C1` is null limit 1000001"}'
Expected behavior
As a reference, MySQL returns a non-empty result set:
mysql> select `bool2`,`C1`from (select `bool2`,sum(`int2`) as `C1`from (select * from `Calcs`where `str1` = "BINDING SUPPLIES") as `ITBL`group by `bool2`) as `ITBL` where not `C1` is null limit 1000001;
+-------+------+
| bool2 | C1 |
+-------+------+
| 0 | 9 |
+-------+------+
1 row in set (0.00 sec)
A Power BI measure got using Import mode instead of DirectQuery:

Host/Environment (please complete the following information):
- Version: 1.2.0 hosted in a docker image
Additional context
Data set was used from TDVT.