christian-schlichtherle opened a new issue, #17994:
URL: https://github.com/apache/druid/issues/17994

   ### Affected Version
   
   Apache Druid 33.0.0
   
   ### Description
   
   I'm computing a distribution of visitors by age and gender. The following 
used to work in Apache Druid 32.0.1, but shows only `null` values in Druid 
33.0.0:
   
   ```
   WITH t1 AS (
     SELECT *
     FROM (
       VALUES
       ('18-19', 'female', 84),
       ('18-19', 'male', 217),
       ('20-29', 'female', 321),
       ('20-29', 'male', 820),
       ('30-39', 'female', 63),
       ('30-39', 'male', 449),
       ('40-49', 'female', 10),
       ('40-49', 'male', 83),
       ('50-59', 'female', 2),
       ('50-59', 'male', 13)
     ) AS data(Age, Gender, Visitors)
   ),
   t2 AS (
     SELECT SUM(Visitors) AS Total FROM t1
   ),
   t3 AS (
     SELECT Age, Gender, CAST(SUM(Visitors) AS double) / Total AS Share
     FROM t1 CROSS JOIN t2
     GROUP BY 1, 2, Total
   )
   SELECT *
   FROM t3
   PIVOT (MAX(Share) FOR Gender IN ('female' AS Women, 'male' AS Men))
   ORDER BY 1
   ```
   
   If you comment out the line starting with `PIVOT ...` then you can see the 
underlying data.


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