Skip to content

feat: Broadcast scalar input for list.slice#27487

Open
Kevin-Patyk wants to merge 4 commits intopola-rs:mainfrom
Kevin-Patyk:feat/slice_broadcast
Open

feat: Broadcast scalar input for list.slice#27487
Kevin-Patyk wants to merge 4 commits intopola-rs:mainfrom
Kevin-Patyk:feat/slice_broadcast

Conversation

@Kevin-Patyk
Copy link
Copy Markdown
Contributor

Resolves #27480.

For the broadcasting, I used new_from_index() because it was already an established pattern being used in concat().

🤖 Claude Sonnet 4.6 for navigating the codebase.

@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 May 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.62%. Comparing base (1156024) to head (e122796).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #27487      +/-   ##
==========================================
+ Coverage   81.14%   81.62%   +0.48%     
==========================================
  Files        1834     1834              
  Lines      254891   254895       +4     
  Branches     3177     3177              
==========================================
+ Hits       206823   208054    +1231     
+ Misses      47246    46019    -1227     
  Partials      822      822              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@nameexhaustion nameexhaustion left a comment

Choose a reason for hiding this comment

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

What about the other codepaths? I'd expect this to be 3-way broadcastable.

@Kevin-Patyk
Copy link
Copy Markdown
Contributor Author

@nameexhaustion Good callout. Moved the condition outside of the match arms and updated the test cover different broadcasting situations.

@Kevin-Patyk Kevin-Patyk requested a review from nameexhaustion May 4, 2026 18:45
let length_s = &args[2];

let target_len = offset_s.len().max(length_s.len());
let list_ca = if list_ca.len() == 1 && target_len > 1 {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It can be prohibitively expensive to be repeating the list values for each row; I'd have expected the implementation to have a kernel that can directly construct the output off of the single input row.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay I will look into it! 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broadcast scalar list input for list.slice

2 participants