- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Error instead of truncate if length mismatch for several str
functions
#20781
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #20781 +/- ##
==========================================
+ Coverage 79.73% 79.78% +0.04%
==========================================
Files 1561 1561
Lines 221910 221994 +84
Branches 2530 2531 +1
==========================================
+ Hits 176938 177115 +177
+ Misses 44390 44297 -93
Partials 582 582 ☔ View full report in Codecov by Sentry. |
str
functionsstr
functions
@@ -466,6 +466,7 @@ fn extract_many( | |||
ascii_case_insensitive: bool, | |||
overlapping: bool, | |||
) -> PolarsResult<Column> { | |||
_check_same_length(s, "extract_many")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change really necessary?
This change broke the R API by preventing the use of str type Series of longer than length 2 as input.
Fixes #16070
The original issue only mentioned
str.zfill()
. There was already a similar check for some functions (e.g.str.head()
). This PR extends this check to morestr
functions and adds tests, but I did not check for other namespaces.Before (1.20.0): silently truncate to parameter length
Now: error