GTerrygo opened a new issue, #15933:
URL: https://github.com/apache/druid/issues/15933

   Please provide a detailed title (e.g. "Broker crashes when using TopN query 
with Bound filter" instead of just "Broker crashes").
   
   ### Affected Version
   
   The latest version 28.0.1
   
   ### Description
   
   We are trying running the following query in web console:
   ```
   WITH
       sum_sales AS (
           SELECT
               user_id,
               SUM(total_product_sales) AS sum_total_product_sales
           FROM "test_table"
           WHERE
               __time BETWEEN '2023-06-01T00:00:00.000Z' AND 
'2024-02-01T00:00:00.000Z'
           GROUP BY user_id
       ),
       percentiles AS (
           SELECT
               APPROX_COUNT_DISTINCT(user_id) AS total_users,
               DS_GET_QUANTILE(DS_QUANTILES_SKETCH(sum_total_product_sales, 
128), 0.05) AS p05,
               DS_GET_QUANTILE(DS_QUANTILES_SKETCH(sum_total_product_sales, 
128), 0.3) AS p30,
               DS_GET_QUANTILE(DS_QUANTILES_SKETCH(sum_total_product_sales, 
128), 0.5) AS p50,
               DS_GET_QUANTILE(DS_QUANTILES_SKETCH(sum_total_product_sales, 
128), 0.7) AS p70,
               DS_GET_QUANTILE(DS_QUANTILES_SKETCH(sum_total_product_sales, 
128), 0.95) AS p95
           FROM user_sum_total_product_sales
       ),
       percentiles_filter AS (
           SELECT
               CASE
                   WHEN total_users < 100 THEN NULL
                   ELSE p05
               END AS p05,
               CASE
                   WHEN total_users < 100 THEN NULL
                   ELSE p30
               END AS p30,
               CASE
                   WHEN total_users < 100 THEN NULL
                   ELSE p50
               END AS p50,
               CASE
                   WHEN total_users < 100 THEN NULL
                   ELSE p70
               END AS p70,
               CASE
                   WHEN total_users < 100 THEN NULL
                   ELSE p95
               END AS p95
           FROM percentiles
       )
   SELECT * from percentiles_filter
   ```
   and then get following error:
   ```
   Error: INVALID_INPUT (ADMIN)
   
   Query could not be planned. A possible reason is [Aggregation 
[DS_QUANTILES_SKETCH($0, $1)] is not supported]
   ```
   We tried only run sum_sales and percentiles subquery, it works which means 
DS_QUANTILES_SKETCH is running well. Once adding percentiles_filter, it failed 
with the error.


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