1

For example, i wanted to write Window functions like sum over (window)

Since over clause is not supported by Druid, how do i achieve the same using Druid Native query API or SQL API?

Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39
Shankar
  • 8,529
  • 26
  • 90
  • 159
  • 1
    There is an extension called ["moving-average-query"](https://druid.apache.org/docs/latest/development/extensions-contrib/moving-average-query.html#basic-example), I dont know whether it works for your need. – tianzhipeng Dec 16 '19 at 06:53

1 Answers1

0

You should use a GroupBy Query. As Druid is a time series database, you have to specify your interval (window) where you want to query data from. You can use aggregation methods over this data, for example a SUM() aggregation.

If you want, you can also do extra filtering within your aggregation, like "only sum records where city=paris"). You could also apply the SUM aggregation only to records which exists in a certain time window within your selected interval.

If you are a PHP user then maybe this package is handy for you: https://github.com/level23/druid-client#sum We have tried to implement an easy way to query such data.

58k723f1
  • 579
  • 2
  • 15
  • This is not really an answer, the questioner is asking if one can some something like: select ... `sum(value) OVER (PARTITION BY some_dim ORDER BY date_month) AS cumulative_total_value ` like this question is asking: https://stackoverflow.com/a/22843199/3089084 – silverdagger Aug 25 '22 at 07:14