smic-datalabs-von commented on issue #10548:
URL: https://github.com/apache/druid/issues/10548#issuecomment-884010117
I encountered this error as well. I am using Superset to create a Sankey
diagram. My data source for this is a virtual dataset coming from a SQL query
issued on Druid that uses `UNION ALL`. Superset then treats this as a subquery
and issues a GROUP BY.
This is the `UNION ALL` query similar to what I have:
```sql
SELECT
a AS column_1
, b AS column_2
, SUM(metric) AS metric
FROM table
UNION ALL
b AS column_1
, c AS column_2
, SUM(metric) AS metric
FROM table
```
In Superset, this is then placed in a subquery and GROUP BY aggregation is
made:
```sql
SELECT
column_1 AS column_1
, column_2 as column_2
, SUM(metric) AS metric
FROM (
-- Place the UNION ALL query above here...
)
GROUP BY column_1, column_2
```
If the query does not contain any aggregations or GROUP BY, it succeeds. For
example:
```sql
SELECT
column_1 AS column_1
, column_2 as column_2
, metric AS metric -- metric column is not aggregated
FROM (
-- Place the UNION ALL query above here...
)
-- No GROUP BY
```
I could have used the third query, but using the Sankey visual in Superset
requires it to be a query like the second snippet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]