Hello everybody, is there a way to create an aggre...
# troubleshooting
d
Hello everybody, is there a way to create an aggregator and return more than one column as result? I have many aggregators to implements and most of them have similar implementations so i thought to share their logic inside ONE aggregator, something like: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-stats-aggregation.html
k
Yes. Its similar to what you did for other aggregation function
d
@Kishore G no wait i missed that part, i know that ONE aggregator can only returns one value only, no?
I mean creating one aggregator like "stats" can i return min, max, avg etc values? instead of using min(amount), max(amount), avg(amount) and so on...
k
you can return whatever you want from the extractFinalResult
we call toString on that
so you can return a {json}
d
omg really?? we were talking about serializing a list etc..do you remember? i did not think it was so simple
that's sounds PERFECT because i will avoid sorting the block again and again (for each aggregator)
@Kishore G if i return a json what about the name of the columns?
can i call they something like avg_column max_column min_column
something like that?
k
its upto you
high level name will be stats
d
Ok, if the high level is "stats" and i return a json like {"a": 1, "b": 2} does it mean that i can reach "a" doing stats.a ?
k
yep
pinot will just return the json
you need to parse it further
d
that's awesome, you know? 😄
k
👍
d
thats another good info to put on doc, i will do it as i told you 👍