Skip to content

feat(firestore): pipeline window functions - #9437

Open
MarkDuckworth wants to merge 10 commits into
mainfrom
markduckworth/window-functions
Open

MarkDuckworth wants to merge 10 commits into
mainfrom
markduckworth/window-functions

Conversation

@MarkDuckworth

Copy link
Copy Markdown
Contributor

No description provided.

- Simplify window partition mapping with fieldOrExpression helper
- Replace WindowFunction._create factory with constructor
- Use _alias and _windowFunction consistently
- Remove references to SQL and MongoDB in documentation
- Remove 'Today' from backend constraint documentation
- Enable window aggregators system test suite against Nightly
@product-auto-label product-auto-label Bot added the api: firestore Issues related to the Firestore API. label Sep 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for window functions in Firestore pipelines, adding the 'addWindowFields' stage, 'WindowFunction' and 'AliasedWindowFunction' classes, and ranking functions such as 'rank', 'denseRank', and 'rowNumber'. The feedback focuses on improving robustness against 'null' values across various window specification properties (such as 'frame', 'unit', 'window', 'sort', 'documents', and 'range') by replacing strict 'undefined' checks with loose nullish checks ('== null'), as well as adding defensive checks for missing or invalid inputs in constructors and stage options.

Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts Outdated
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts Outdated
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
Comment thread handwritten/firestore/dev/src/pipelines/pipelines.ts
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
Comment thread handwritten/firestore/dev/src/pipelines/expression.ts
- Keep AliasedWindowFunction consistent with AliasedAggregate (internal _windowFunction/_alias).
- Document that 'current' is peer-inclusive in range frames and positional in documents frames.
- Add system tests for tied peers in range vs documents frames, string and multi-key range sorts, and fractional range offsets.
- Clean up test comments and update the API report.
@MarkDuckworth
MarkDuckworth marked this pull request as ready for review October 23, 2026 21:46
@MarkDuckworth
MarkDuckworth requested review from a team as code owners October 23, 2026 21:46

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the Firestore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant