ul-fra opened a new issue #17035:
URL: https://github.com/apache/superset/issues/17035


   First of all I have setup Superset with the current docker image 
(https://superset.apache.org/docs/installation/installing-superset-using-docker-compose)
 on an AWS EC2 instance. I've also installed superset on my local laptop 
(https://hub.docker.com/r/apache/superset) but had the same thing.
   
   After registering the AWS Athena driver and an dataset, I have created a 
simple time series diagram with a "group by". The query is working and data is 
visualized. Please see screenshot.
   
   When I look at the sql query executed by Athena you can see this: --> ### 
Actual results
   
   There is a subquery included in the query which seems to be useless. The 
columns of the subquery are not used in the outer query. The join is useless.
   
   The disadvantage is, that the query takes much more time with this subquery 
- x*100% in comparision to the expected query.
   
   #### How to reproduce the bug
   
   create a timeseries chart and group by an attribute.
   
   ### Expected results
   
   SELECT date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP)) 
AS "__timestamp",
          "c_jobid" AS "c_jobid",
          COUNT(*) AS "count"
   FROM "x"."y"
   WHERE "p_date" >= '2021-10-01'
   GROUP BY "c_jobid",
            date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP))
   ORDER BY "count" DESC
   LIMIT 1000
   
   ### Actual results
   
   SELECT date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP)) 
AS "__timestamp",
          "c_jobid" AS "c_jobid",
          COUNT(*) AS "count"
   FROM "x"."y"
   JOIN
     (SELECT "c_jobid" AS "c_jobid__",
             COUNT(*) AS "mme_inner__"
      FROM "vehicle_cdc2_cca_qual_pre"."te_mgu"
      WHERE "p_date" >= '2021-10-01'
      GROUP BY "c_jobid"
      ORDER BY "mme_inner__" DESC
      LIMIT 100) AS "anon_1" ON "c_jobid" = "c_jobid__"
   WHERE "p_date" >= '2021-10-01'
   GROUP BY "c_jobid",
            date_trunc('day', CAST(date_parse(p_date, '%Y-%m-%d') AS TIMESTAMP))
   ORDER BY "count" DESC
   LIMIT 1000
   
   #### Screenshots
   
   <img width="820" alt="grafik" 
src="https://user-images.githubusercontent.com/68276432/136579420-abbe922f-363d-41d6-86b6-51294f930c55.png";>
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: Firefox 88.0
   - superset version: Superset 0.0.0dev
   - python version: Python 3.8.12
   - node.js version: ? (docker exec -it superset node -v --> node not on path)
   - any feature flags active: no
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version 
of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   
   


-- 
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]

Reply via email to