egor-ryashin commented on issue #16728:
URL: https://github.com/apache/druid/issues/16728#issuecomment-2228989755

   I added cardinality by grouping additional dimensions - now it looks like 
this:
   ```
   select "camp",  "buyer" , "source" ,
     sum(cnt) filter (where __time >= '2024-06-01' and __time < '2024-06-07') p,
     sum(cnt) filter (where __time >= '2024-06-07' and __time < '2024-06-14') n,
     sum(cnt) filter (where __time >= '2024-06-07' and __time < '2024-06-14') - 
sum(cnt) filter (where __time >= '2024-06-01' and __time < '2024-06-07') delta
   from atd_pba 
   where __time >= '2024-06-01' and __time < '2024-06-14' 
    group by 1,2,3 
   order by delta 
     limit 10
   ```
   ```
   select p."camp", p. "buyer" ,p. "source",any_value(p.c), any_value(n.c), 
any_value(n.c- p.c ) delta from ( 
     select "camp", "buyer" , "source" , sum(cnt)  c from atd_pba where   
__time >= '2024-06-01' and __time < '2024-06-07' group by 1,2,3
   ) p 
   left join 
   (
     select "camp", "buyer" , "source" , sum(cnt) c from atd_pba where   __time 
>= '2024-06-07' and __time < '2024-06-14'  group by 1,2,3
   ) n
    on p.camp is not distinct from n.camp and p.buyer is not distinct from 
n.buyer and p.source is not distinct from n.source
   group by 1,2,3
   order by delta 
   limit 10
   ```


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