AllDotPy / AllDotPy/Ryx

feat: implement Window Functions (RANK, ROW_NUMBER, etc.)

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Extend the QueryNode and the compiler in ryx-query to support the OVER (...) clause.
  2. Implement a Window expression class in Python that integrates with the existing annotation system. Label: advanced

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.