Skip to content

feat(firestore): implement pipeline window functions - #14504

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

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

Conversation

@MarkDuckworth

Copy link
Copy Markdown
Contributor

No description provided.

- Add AddWindowFields stage and Pipeline.addWindowFields overloads
- Add WindowSpec, WindowBound, WindowFunction, and AliasedWindowFunction
- Add AggregateFunction.over(WindowSpec) to evaluate aggregates over window frames
- Add serialization and proto tests in AddWindowFieldsProtoTest and PipelineProtoTest
- Add integration tests in ITPipelineTest with array_agg_distinct enabled against Nightly

@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 the Firestore pipeline API, adding the addWindowFields stage along with supporting classes like WindowSpec, WindowFunction, WindowBound, and AliasedWindowFunction. It also includes extensive unit and integration tests to validate various windowing behaviors such as partitioning, sorting, and framing. A review comment suggests adding an explicit null check in WindowSpec.toBoundaryExpr to prevent potential serialization errors when a null boundary is provided.

- Replace the WindowBound enum with a final class exposing CURRENT/UNBOUNDED constants; remove the WindowSpec.CURRENT/UNBOUNDED aliases.
- Remove WindowSpec.partition(FieldPath...) and the getPartition()/getSort() getters.
- Document that CURRENT is peer-inclusive in range frames and positional in documents frames.
- Add integration tests for tied peers, string and multi-key range sorts, and double range offsets.
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant