feat: implement Window Functions (RANK, ROW_NUMBER, etc.)
Open
Nobody has claimed this yet.
enhancement
query builder
ryx-query
- Dominant language
- Rust
- Stars
- 13
- Forks
- 5
- Avg merge
- 1h 49m
- Merged PRs (30d)
- 3
Description
To support complex analytics, Ryx needs to support SQL Window Functions.
Goal: Allow the use of RANK(), DENSE_RANK(), ROW_NUMBER(), and LEAD/LAG within annotate().
Example usage:
# Rank posts by views within their category
posts = await Post.objects.annotate(
rank=Window(func=Rank(), partition_by="category", order_by="views")
)
Implementation hint:
- Extend the QueryNode and the compiler in ryx-query to support the OVER (...) clause.
- Implement a Window expression class in Python that integrates with the existing annotation system. Label: advanced
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing annotate() path into the QueryNode and compiler in ryx-query, then inspect how Python expressions integrate with annotations. Implement the Window expression around the stated RANK, DENSE_RANK, ROW_NUMBER, and LEAD/LAG cases and verify that compilation produces the required OVER (...) clause for the example usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust, sql
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100