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: Implement merge_sorted for binary #21045

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mcrumiller
Copy link
Contributor

@mcrumiller mcrumiller commented Feb 2, 2025

Quite trivial, closes #20988

import polars as pl

df1 = pl.DataFrame({
    "a": pl.Series("a", [b"1", b"3", b"5"], pl.Binary()),
    "b": [1, 3, 5],
})
df2 = pl.DataFrame({
    "a": pl.Series("a", [b"2", b"4", b"6"], pl.Binary()),
    "b": [2, 4, 6],
})

print(df1.merge_sorted(df2, "a"))
# shape: (6, 2)
# ┌────────┬─────┐
# │ a      ┆ b   │
# │ ---    ┆ --- │
# │ binary ┆ i64 │
# ╞════════╪═════╡
# │ b"1"   ┆ 1   │
# │ b"2"   ┆ 2   │
# │ b"3"   ┆ 3   │
# │ b"4"   ┆ 4   │
# │ b"5"   ┆ 5   │
# │ b"6"   ┆ 6   │
# └────────┴─────┘

@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 Feb 2, 2025
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.28%. Comparing base (1678638) to head (05b9e52).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #21045   +/-   ##
=======================================
  Coverage   79.27%   79.28%           
=======================================
  Files        1583     1583           
  Lines      225549   225553    +4     
  Branches     2586     2586           
=======================================
+ Hits       178810   178831   +21     
+ Misses      46149    46132   -17     
  Partials      590      590           

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

@mcrumiller mcrumiller marked this pull request as ready for review February 3, 2025 00:55
@@ -157,6 +157,12 @@ fn series_to_merge_indicator(lhs: &Series, rhs: &Series) -> Vec<bool> {

get_merge_indicator(lhs.into_iter(), rhs.into_iter())
},
DataType::Binary => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you dispatch String via binary as well? That saves an extra monomorphization.

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.

Merge sorted not implemented for binary
2 participants