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: Add outer validity to AnyValueBufferTrusted for structs #20713

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

orlp
Copy link
Collaborator

@orlp orlp commented Jan 14, 2025

This technically changes behavior for df.pivot (possibly other things), but the old behavior was honestly bugged (despite us having a test for it).

Old behavior:

>>> df
┌─────┬──────┬──────┬──────┬───────────┐
│ idweeknum1num2nums      │
│ ---------------       │
│ strstri64i64struct[2] │
╞═════╪══════╪══════╪══════╪═══════════╡
│ a114    ┆ {1,4}     │
│ a235    ┆ {3,5}     │
│ b353    ┆ {5,3}     │
│ c444    ┆ {4,4}     │
│ c336    ┆ {3,6}     │
│ c166    ┆ {6,6}     │
└─────┴──────┴──────┴──────┴───────────┘
>>> df.pivot(values="nums", index="id", on="week", aggregate_function="first")
┌─────┬─────────────┬─────────────┬─────────────┬─────────────┐
│ id1234           │
│ ---------------         │
│ strstruct[2]   ┆ struct[2]   ┆ struct[2]   ┆ struct[2]   │
╞═════╪═════════════╪═════════════╪═════════════╪═════════════╡
│ a   ┆ {1,4}       ┆ {3,5}       ┆ {null,null} ┆ {null,null} │
│ b   ┆ {null,null} ┆ {null,null} ┆ {5,3}       ┆ {null,null} │
│ c   ┆ {6,6}       ┆ {null,null} ┆ {3,6}       ┆ {4,4}       │
└─────┴─────────────┴─────────────┴─────────────┴─────────────┘

New behavior:

┌─────┬───────────┬───────────┬───────────┬───────────┐
│ id1234         │
│ ---------------       │
│ strstruct[2] ┆ struct[2] ┆ struct[2] ┆ struct[2] │
╞═════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ a   ┆ {1,4}     ┆ {3,5}     ┆ nullnull      │
│ bnullnull      ┆ {5,3}     ┆ null      │
│ c   ┆ {6,6}     ┆ null      ┆ {3,6}     ┆ {4,4}     │
└─────┴───────────┴───────────┴───────────┴───────────┘

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jan 14, 2025
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.92%. Comparing base (1cd72ff) to head (b96effd).
Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-core/src/frame/row/av_buffer.rs 84.61% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #20713   +/-   ##
=======================================
  Coverage   79.92%   79.92%           
=======================================
  Files        1559     1559           
  Lines      221181   221178    -3     
  Branches     2530     2530           
=======================================
+ Hits       176774   176784   +10     
+ Misses      43825    43812   -13     
  Partials      582      582           

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

@orlp orlp merged commit c3a7460 into pola-rs:main Jan 14, 2025
29 checks passed
@c-peters c-peters added the accepted Ready for implementation label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants