In Elasticsearch we can do a group by gender, and then sub-group in each gender by state, and sum a metric, and get the top 10 results (for that sum of that metric) per state.
There doesn't seem to be a way to currently do that in Pinot, though @kishoreg suggested it would be possible via a UDF (let's call it "subBuckets"), something like select <top bucket column>, subBuckets(<aggregation operation>, <sub-bucket column>, <max_values>) from <table> group by <top bucket column>. For example:
select gender, subBuckets(sum(billed_expenses), state, 10) from medicare_expenses group by gender
In Elasticsearch we can do a group by gender, and then sub-group in each gender by state, and sum a metric, and get the top 10 results (for that sum of that metric) per state.
There doesn't seem to be a way to currently do that in Pinot, though @kishoreg suggested it would be possible via a UDF (let's call it "subBuckets"), something like
select <top bucket column>, subBuckets(<aggregation operation>, <sub-bucket column>, <max_values>) from <table> group by <top bucket column>. For example: