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 incorrect lazy schema for aggregations #19753

Merged
merged 4 commits into from
Nov 13, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Nov 13, 2024

Fixes #19752

Also adjusts a CI workflow file to fix code coverage

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Nov 13, 2024
*agg_list = false;
let mut field = arena
.get(*expr)
.to_field_impl(schema, ctx, arena, &mut false)?;
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Nov 13, 2024

Choose a reason for hiding this comment

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

We previously set agg_list to false (*nested = nested.saturating_sub(1)), but then we passed it to to_field_impl, so it would get incorrectly overridden by the upper node - this is the cause of the linked issue.

// Indicates whether we should auto-implode the result. This is initialized to true if we are
// in an aggregation context, so functions that return scalars should explicitly set this
// to false in `to_field_impl`.
let mut agg_list = matches!(ctx, Context::Aggregation);
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Nov 13, 2024

Choose a reason for hiding this comment

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

Refactored to use a bool indicator - I think we only need to keep track of 2 states

run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Nov 13, 2024

Choose a reason for hiding this comment

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

drive-by fix CI, ~/.local/bin needs to be in $PATH to use uv - we only seem to need this on macOS runners

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.72%. Comparing base (3cdb7c2) to head (0ebd8aa).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19753      +/-   ##
==========================================
- Coverage   79.73%   79.72%   -0.02%     
==========================================
  Files        1542     1543       +1     
  Lines      212223   212715     +492     
  Branches     2449     2443       -6     
==========================================
+ Hits       169216   169583     +367     
- Misses      42453    42582     +129     
+ Partials      554      550       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 87367e9 into pola-rs:main Nov 13, 2024
26 checks passed
@nameexhaustion nameexhaustion deleted the lazy-schema branch November 18, 2024 08:21
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.

Incorrect lazy schema for aggregation operation preceded by non-aggregation
2 participants