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

fix: rolling_* aggs were behaving as if they return scalars in group-by #15657

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

closes #15656

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Apr 15, 2024
@MarcoGorelli MarcoGorelli changed the title fix: dont register rolling_* aggs as returning scalars fix: rolling_* aggs were behaving as if they return scalars in group-by Apr 15, 2024
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 15, 2024 09:33
Copy link

codspeed-hq bot commented Apr 15, 2024

CodSpeed Performance Report

Merging #15657 will not alter performance

Comparing MarcoGorelli:rolling-aggs-return-scalar (3e4375f) with main (99ab9c0)

Summary

✅ 22 untouched benchmarks

@@ -1208,7 +1208,7 @@ impl Expr {
self.apply_many_private(
FunctionExpr::RollingExpr(rolling_function_by(options)),
&[col(&name)],
true,
false,
Copy link
Member

Choose a reason for hiding this comment

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

Ai, good catch. That took a long time.

Copy link
Collaborator

@reswqa reswqa Apr 15, 2024

Choose a reason for hiding this comment

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

Just wondering what's the principle here, it seems to be the same behavior for reduce/fold (return_scalars=True).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rolling functions return something which is the same length as the input, so I don't think they should ever return a scalar

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeap, I see. But IIRC, the output of fold/reduce should also be consistent with the length of the input.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah thanks - will take a look, have made a note-to-self

@ritchie46 ritchie46 merged commit 4e17d02 into pola-rs:main Apr 15, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rolling_* aggs behave as if they return scalars in group-by
3 participants