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

feat: Add pl.concat_arr to concatenate columns into an Array column #19881

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Nov 20, 2024

Fixes #18090

Allows users to concatenates one or more input columns into a fixed-width array column. The input columns are required to have dtypes of either Array(<Dtype>, width) or <Dtype>.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Nov 20, 2024
/// * `widths[i] * output_height`
/// * `widths[i]` (this would be broadcasted)
/// * All arrays in `arrays` have the same type
pub unsafe fn horizontal_flatten_unchecked(
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Nov 20, 2024

Choose a reason for hiding this comment

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

Added fn horizontal_flatten_unchecked under polars-compute, which performs the flatten operation that creates the values array of the result. This is called from fn concat_arr under polars-ops after it checks the safety conditions.

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 79.94580% with 74 lines in your changes missing coverage. Please review.

Project coverage is 79.43%. Comparing base (426cf27) to head (e710547).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rates/polars-compute/src/horizontal_flatten/mod.rs 60.28% 56 Missing ⚠️
crates/polars-plan/src/dsl/function_expr/array.rs 81.81% 8 Missing ⚠️
crates/polars-ops/src/series/ops/concat_arr.rs 93.02% 6 Missing ⚠️
...s/polars-compute/src/horizontal_flatten/struct_.rs 94.59% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #19881    +/-   ##
========================================
  Coverage   79.43%   79.43%            
========================================
  Files        1551     1554     +3     
  Lines      215222   215591   +369     
  Branches     2452     2452            
========================================
+ Hits       170954   171265   +311     
- Misses      43710    43768    +58     
  Partials      558      558            

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


🚨 Try these New Features:

@ritchie46 ritchie46 merged commit cf6f375 into pola-rs:main Nov 20, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Concatenation of array columns, similar to concat_list
2 participants