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(python): series.search_sorted could support more types of input #15940

Merged
merged 1 commit into from Apr 28, 2024

Conversation

reswqa
Copy link
Collaborator

@reswqa reswqa commented Apr 28, 2024

Fixes #15911.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Apr 28, 2024
@reswqa reswqa force-pushed the series_search_sorted branch 2 times, most recently from 8a96067 to b7cc718 Compare April 28, 2024 09:04
@@ -2263,7 +2265,7 @@ def search_sorted(self, element: IntoExpr, side: SearchSortedSide = "any") -> Se
│ 0 ┆ 2 ┆ 4 │
└──────┴───────┴─────┘
"""
element = parse_as_expression(element)
element = parse_as_expression(element, list_as_lit=False, str_as_lit=True) # type: ignore[arg-type]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

list_as_lit => False is ok as List dtype is not supported.

But str_as_lit => True should be careful, It breaks the previous behavior for str type input. But I want to argue this as a bug-fix, because we already had support for String type in rust side, but it just didn't get exposed due to the bug in python side. If we had been aware of this from the beginning, str would never have been used as a column name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

# type: ignore[arg-type] as the same reason with #12792.

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.25%. Comparing base (f1846a9) to head (b7cc718).

❗ Current head b7cc718 differs from pull request most recent head d222877. Consider uploading reports for the commit d222877 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15940      +/-   ##
==========================================
- Coverage   81.25%   81.25%   -0.01%     
==========================================
  Files        1381     1381              
  Lines      176597   176598       +1     
  Branches     3028     3028              
==========================================
- Hits       143496   143493       -3     
- Misses      32620    32623       +3     
- Partials      481      482       +1     
Flag Coverage Δ
python 74.68% <100.00%> (-0.01%) ⬇️
rust 78.37% <37.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@reswqa reswqa marked this pull request as ready for review April 28, 2024 10:14
Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

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

Nice!

@ritchie46 ritchie46 merged commit 7ae1e58 into pola-rs:main Apr 28, 2024
11 of 13 checks passed
@reswqa reswqa deleted the series_search_sorted branch April 28, 2024 16:15
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.search_sorted(...) broken on Series with dtype pl.Date
2 participants