apache / apache/pinot

Hierarchical GROUP BY aggregation

Open
#8,040 2 comments 1 reaction 1 assignee Claimed by @atris View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
189

Description

Consider the schema -- Country, salesPersonName, AmountSold

We want to find out top N countries by total amount of sales. For each such top N country, we want to find the top N sales people who have done the maximum total sales.

Input

```
India abc 100
India def 250
India ijk 500
China pqr 150
China bcd 350
China bcd 100
China qwe 320
US dsv 100
US xyz 300
US asd 330
```

N = 2

Output

```
China 920 bcd 450
China 920 qwe 320
India 850 ijk 500
India 850 def 250
```

The value of N can differ from one level to next level in hierarchy. In the above example, N could be 3 at the country level (level 0) and 2 at the salesPersonName level (level 1)

The query syntax will have to be discussed to understand how to specify the different levels and N value at each level. The output format shown above is to explain concept but should be discussed as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.