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

   I’m having trouble using window functions in Druid v27.0.0. I have added 
`"windowsAreForClosers": true` to the query context. For demonstration 
purposes, I am using the data source described in this blog posting: 
https://blog.hellmar-becker.de/2023/03/26/druid-26-sneak-peek-window-functions/
   
   Here’s my query:
   
   ```sql
   with t1 as (
     select
       floor(__time to day) as "date",
       array_agg(distinct user_id) as user_ids
     from events
     group by 1
   )
   select
     "date",
     array_concat_agg(distinct user_ids, 65536) over (order by "date" rows 
unbounded preceding) as cumulative_user_ids
   from t1
   order by 1
   ```
   
   This is the response from the web console:
   
   ```
   Error: UNCATEGORIZED (ADMIN)
   
   Error while applying rule DruidOuterQueryRel(WINDOW), args 
[rel#61203:LogicalWindow.NONE.[](input=RelSubset#61183,window#0=window(partition
 {} order by [0] rows between UNBOUNDED PRECEDING and CURRENT ROW aggs 
[ARRAY_CONCAT_AGG($1, $2)])), 
rel#61214:DruidQueryRel.NONE.[0](query={"queryType":"timeseries","dataSource":{"type":"table","name":"events"},"intervals":{"type":"intervals","intervals":["-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"]},"granularity":"DAY","aggregations":[{"type":"expression","name":"a0","fields":["user_id"],"accumulatorIdentifier":"__acc","initialValue":"ARRAY<LONG>[]","initialCombineValue":"ARRAY<LONG>[]","isNullUnlessAggregated":true,"shouldAggregateNullInputs":true,"shouldCombineAggregateNullInputs":false,"fold":"array_set_add(\"__acc\",
 \"user_id\")","combine":"array_set_add_all(\"__acc\", 
\"a0\")","maxSizeBytes":1024}],"context":{"queryId":"0caf2e20-cfc1-44d7-9903-4125bc08ac6e","skipEmptyBuckets":true,"sqlOuterLimit":1001,"sqlQueryId":"0c
 
af2e20-cfc1-44d7-9903-4125bc08ac6e","timestampResultField":"d0","windowsAreForClosers":true}},signature={d0:LONG,
 a0:ARRAY<LONG>})]
   ```
   
   For comparison, this works (although not very useful):
   
   ```sql
   with t1 as (
     select
       floor(__time to day) as "date",
       count(distinct user_id) as user_ids
     from events
     group by 1
   )
   select
     "date",
     sum(user_ids) over (order by "date" rows unbounded preceding) as 
cumulative_user_ids
   from t1
   order by 1
   ```
   
   Please include as much detailed information about the problem as possible.
   - Cluster size: One node for development
   - Configurations in use: `druid.generic.useDefaultValueForNull=false`


-- 
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: commits-unsubscr...@druid.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to