Druid Roll up during ingestion

Hi,

I need help with a rollup use case during ingestion. I am using kafka indexer for ingestion. I am ingesting metrics in minute level granularity(time dimension has minute level timestamp) and intend to roll it up to 60 minutes. All the metric columns defined in druid are either long, double or float. As per https://staging-www.druidforum.org/docs/querying/aggregations.html we can define sum, min, max and count aggregators on metric column during ingestion.

We cannot use "First / Last aggregator” during ingestion. But we have use case where for a specific metric column we need to get the last value based on the highest timestamp during rollup.

Example:

Input minute level data:

time dimension
Metric Value
1
30
2
20

40
60
15

Expected 60 minute rolled up data during ingestion:

time dimension
Metric value
60
15

There is a "JavaScript aggregator” where you can define a custom aggregation function. But this function is not useful unless we have access to “time” from the previous rows as well(so that we can compare the timestamp and take the metric value corresponding to higher timestamp). Is there any good way to perform this rollup in druid during ingestion?

Thanks & Regards,

Sakthi