Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

per-group topk #968

Merged
merged 2 commits into from
Nov 2, 2023
Merged

per-group topk #968

merged 2 commits into from
Nov 2, 2023

Conversation

mihaibudiu
Copy link
Collaborator

Is this a user-visible change (yes/no): yes

This has been rebased on top of #966, making it unnecessary.

Leonid Ryzhyk and others added 2 commits October 31, 2023 17:11
Implement three versions of the top-k operator that ranks values in the
group and outputs the rank along with the element.

These operators can be used to implement the following SQL pattern:

```sql
SELECT
     ...,
     RANK_FUNCTION() OVER (PARTITION BY .. ORDER BY ...) AS rank
FROM table
WHERE rank <= K
```

where `RANK_FUNCTION` can be one of

- `ROW_NUMBER`
- `RANK`
- `DENSE_RANK`

Signed-off-by: Leonid Ryzhyk <leonid@feldera.com>
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
@ryzhyk ryzhyk added SQL compiler Related to the SQL compiler DBSP core Related to the core DBSP library labels Nov 1, 2023
@ryzhyk ryzhyk added this to the November 07, 2023 milestone Nov 1, 2023

where `agg` is one of the operators in the following table.

<table>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support all of these yet, do we?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grammar does, but they are marked in the wishlist as unsupported

@mihaibudiu mihaibudiu merged commit eaa7f96 into main Nov 2, 2023
5 checks passed
@mihaibudiu mihaibudiu deleted the group-topk branch November 2, 2023 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DBSP core Related to the core DBSP library SQL compiler Related to the SQL compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants