cosmin-mogos opened a new issue #10090:
URL: https://github.com/apache/druid/issues/10090


   We have a simple query to return the count of some events.
   
   ```sql
   select count(*) from events where type='the event'
   ```
   
   The problem is that if no events match the query 0 rows are returned, since 
we use it for alerts we'd like the query above to return a row with 0 value in 
case no events match the where clause. How can we achieve this?
   
   The closest I managed was with
   
   ```sql
   select sum(c) from (
       select count(*) as c from events where type='the event'
       union all
       select 0 as c from events limit 1
   )
   ```
   
   which fails with `Cannot build plan for query`, but succeeds if the `sum(c)` 
is replaced with just `c`.


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

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