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: Start of Series.index_of(), for primitive numeric types #19894

Draft
wants to merge 51 commits into
base: main
Choose a base branch
from

Conversation

itamarst
Copy link
Contributor

@itamarst itamarst commented Nov 20, 2024

First part of #5503.

Next steps, in follow-up PRs:

  • Bools.
  • Strings.
  • Dates and times other non-primitive types.
  • Lists and arrays.

@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
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 94.06780% with 7 lines in your changes missing coverage. Please review.

Project coverage is 79.52%. Comparing base (5f61d70) to head (81c02e5).
Report is 49 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-ops/src/series/ops/index_of.rs 96.61% 2 Missing ⚠️
...ates/polars-plan/src/dsl/function_expr/index_of.rs 93.33% 2 Missing ⚠️
.../polars-python/src/lazyframe/visitor/expr_nodes.rs 0.00% 2 Missing ⚠️
crates/polars-plan/src/dsl/function_expr/mod.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #19894       +/-   ##
===========================================
+ Coverage   59.38%   79.52%   +20.14%     
===========================================
  Files        1554     1558        +4     
  Lines      215612   216644     +1032     
  Branches     2452     2456        +4     
===========================================
+ Hits       128035   172283    +44248     
+ Misses      87019    43804    -43215     
+ Partials      558      557        -1     

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

crates/polars-ops/src/series/ops/index_of.rs Outdated Show resolved Hide resolved
crates/polars-ops/src/series/ops/index_of.rs Outdated Show resolved Hide resolved
dtype if dtype.is_unsigned_integer() => value.cast(&DataType::UInt64),
dtype if dtype.is_float() => value.cast(&DataType::Float64),
DataType::Null => AnyValue::Null,
_ => unimplemented!("index_of() not yet supported for dtype {:?}", value_dtype),
Copy link
Member

Choose a reason for hiding this comment

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

The other types (except boolean) can go into the row-encoding and use the branch for binary data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really understand what this means, could you expand a little? (I will probably do those in separate PR, but still good to start that with the right approach to save time.)

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be in one go, as I think it can all go to a single generic impl.

Copy link
Member

Choose a reason for hiding this comment

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

The row-encoding is used in multi-key group-bys/joins and joins on nested types. I would recommend reading in the join dispatch. Can give a bit more pointers, if you get lost. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK will go read.

@itamarst itamarst marked this pull request as draft November 27, 2024 15:00
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.

4 participants