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: fix project pushdown for double projection contains count #11843

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

reswqa
Copy link
Collaborator

@reswqa reswqa commented Oct 19, 2023

This fixes #11841.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Oct 19, 2023
@@ -29,6 +54,14 @@ pub(super) fn process_projection(
// simply select the first column
let (first_name, _) = input_schema.try_get_at_index(0)?;
let expr = expr_arena.add(AExpr::Column(Arc::from(first_name.as_str())));
if !acc_projections.is_empty() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure would it be more reasonable to clear acc_projections and projected_names directly here? Because we seem to be only concerned with the first input. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Yes, good point. We could immediately move those to the "local" projection.

Copy link
Collaborator Author

@reswqa reswqa Oct 20, 2023

Choose a reason for hiding this comment

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

oops, if we immediately move all acc_projections to local projection.

pl.LazyFrame({"x" : 1}).select(pl.count().alias("r")).select(pl.col("r")).collect()

Will panic durning build local_projections as we push down pl.col("r") to the first select.

PanicException: called `Result::unwrap()` on an `Err` value: ColumnNotFound(ErrString("r"))

Copy link
Member

Choose a reason for hiding this comment

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

Ok, let's leave it like this. It seems pretty clean now. :)

@reswqa reswqa marked this pull request as ready for review October 19, 2023 08:17
@@ -29,6 +54,14 @@ pub(super) fn process_projection(
// simply select the first column
let (first_name, _) = input_schema.try_get_at_index(0)?;
let expr = expr_arena.add(AExpr::Column(Arc::from(first_name.as_str())));
if !acc_projections.is_empty() {
Copy link
Member

Choose a reason for hiding this comment

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

Ok, let's leave it like this. It seems pretty clean now. :)

@ritchie46 ritchie46 merged commit 0b8be40 into pola-rs:main Oct 20, 2023
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.

ComputeError / panic on projection pushdown using .count()
2 participants