Skip to content

Support limiting sub-groups to top N #6292

@kkrugler

Description

@kkrugler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions