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

refactor: remove more useless dispatched methods from Series #1008

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

eitsupi
Copy link
Collaborator

@eitsupi eitsupi commented Apr 1, 2024

I listed the RPolarsSeries-specific methods that are not present in the Series of Python Polars as shown below, and checked to see if any extra methods were dispatched from Expr.

In Python:

import polars as pl

l = dir(pl.Series)

with open("list.txt", "w") as f:
    for item in l:
        f.write(f"{item}\n")

Then, in R:

> methods_py <- readr::read_lines("list.txt")
> methods_r <- ls(polars::.pr$env$RPolarsSeries)
> setdiff(methods_r, methods_py)
 [1] "add"             "and"             "approx_n_unique" "backward_fill"   "compare"        
 [6] "div"             "exclude"         "first"           "flatten"         "floor_div"      
[11] "forward_fill"    "gt_eq"           "inspect"         "last"            "lt_eq"          
[16] "map_batches"     "mod"             "mul"             "neq"             "neq_missing"    
[21] "not"             "or"              "print"           "rep"             "rep_extend"     
[26] "repeat_by"       "sort_by"         "sub"             "to_lit"          "to_r"           
[31] "to_struct"       "to_vector"       "xor"

As a result, several methods were determined to be unnecessary and will be removed.
(There are others that are only available in R, but Python does not dispatch Expr methods outside of the subnamespace, so it appears that not all Expr methods are available on the Series.)

See #1006 for rep_extend.

Comment on lines -206 to -238
---

Code
ls(.pr[[private_key]])
Output
[1] "clone_in_rust" "collect"
[3] "collect_in_background" "debug_plan"
[5] "describe_optimized_plan" "describe_plan"
[7] "drop" "drop_nulls"
[9] "explode" "fetch"
[11] "fill_nan" "fill_null"
[13] "filter" "first"
[15] "get_optimization_toggle" "group_by"
[17] "group_by_dynamic" "join"
[19] "join_asof" "last"
[21] "max" "mean"
[23] "median" "melt"
[25] "min" "print"
[27] "profile" "quantile"
[29] "rename" "reverse"
[31] "rolling" "schema"
[33] "select" "select_seq"
[35] "set_optimization_toggle" "shift"
[37] "shift_and_fill" "sink_csv"
[39] "sink_ipc" "sink_json"
[41] "sink_parquet" "slice"
[43] "sort_by_exprs" "std"
[45] "sum" "tail"
[47] "to_dot" "unique"
[49] "unnest" "var"
[51] "with_columns" "with_columns_seq"
[53] "with_context" "with_row_index"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is probably due to unnecessary changes that occurred when resolving merge conflicts on some PR and were incorporated into the main branch.

Copy link
Collaborator

@etiennebacher etiennebacher left a comment

Choose a reason for hiding this comment

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

Thanks

@etiennebacher etiennebacher merged commit 50b44de into main Apr 1, 2024
19 checks passed
@etiennebacher etiennebacher deleted the more-exclude branch April 1, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants