Skip to content

Conversation

itamarst
Copy link
Contributor

@itamarst itamarst commented Sep 4, 2025

Fixes #23476

Previously out-of-range integers would be cast to Null, and then if there was a Null in the series its index would be returned. I.e. index_of() was giving wrong results.

# Previous behavior, before the fix:
>>> pl.Series([0, 2, 255, None], dtype=pl.UInt8).index_of(np.uint16(256))
3

Now it does the right thing and errors out. Similarly for other cases of lossy casting, not all of which were caught when FirstArgLossLess was first implemented.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Sep 4, 2025
@itamarst itamarst marked this pull request as ready for review September 4, 2025 18:22
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 97.01493% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@9e6e923). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ars-plan/src/plans/conversion/type_coercion/mod.rs 97.01% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24369   +/-   ##
=======================================
  Coverage        ?   81.81%           
=======================================
  Files           ?     1683           
  Lines           ?   229094           
  Branches        ?     2943           
=======================================
  Hits            ?   187444           
  Misses          ?    40911           
  Partials        ?      739           

☔ 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.

@ritchie46 ritchie46 force-pushed the main branch 2 times, most recently from b4826f9 to ddf5907 Compare September 27, 2025 11:04
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 rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Out-of-range integers give wrong results in index_of() in some cases
2 participants