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

chore: allow PRECEDING and FOLLOWING to appear on both side of BETWEEN when windowing #1507

Merged
merged 11 commits into from
Mar 25, 2025

Conversation

sycai
Copy link
Contributor

@sycai sycai commented Mar 19, 2025

This paves the way for introducing closed parameter for rolling.

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Mar 19, 2025
@sycai sycai marked this pull request as ready for review March 19, 2025 22:14
@sycai sycai requested review from a team as code owners March 19, 2025 22:14
@sycai sycai requested a review from ZehaoXU March 19, 2025 22:14
Comment on lines 159 to 160
start: Optional[WindowBoundary[int]] = None
end: Optional[WindowBoundary[int]] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to create boundary classes, shouldn't we just go all the way and defined an "UNBOUNDED" subclass as well, instead of using null?

Alternatively, we can just stick to integers, and use postive and negative ints to mean following and proceeding respectively

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call on sticking to integers. It makes subsequent processing logic much simpler!

Comment on lines 140 to 141
class WindowBoundary(Generic[T]):
value: T
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit iffy on mixing value ranges and offsets in a single class, but I guess it works since the syntax is the same after (rows/range) between?

Copy link
Contributor Author

@sycai sycai Mar 24, 2025

Choose a reason for hiding this comment

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

Yes exactly. The syntax is defined just as you said.

@sycai sycai merged commit 4b0cf57 into main Mar 25, 2025
23 of 24 checks passed
@sycai sycai deleted the sycai_rolling_window branch March 25, 2025 17:55
shobsi pushed a commit that referenced this pull request Mar 28, 2025
…N when windowing (#1507)

* chore: allow PRECEDING and FOLLOWING to appear on both side of BETWEEN when windowing

* fix lint

* Simplify the code by using the sign of the value for PRECEDING/FOLLOWING

* fix lint

* fix mypy

* polish doc

* remove float support for range rolling because Pandas does not support that
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants