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: more arguments for as.data.frame #762

Merged
merged 4 commits into from
Feb 2, 2024
Merged

feat: more arguments for as.data.frame #762

merged 4 commits into from
Feb 2, 2024

Conversation

eitsupi
Copy link
Collaborator

@eitsupi eitsupi commented Feb 1, 2024

No description provided.

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, some minor comments

R/s3_methods.R Outdated Show resolved Hide resolved
no_optimization = FALSE,
inherit_optimization = FALSE,
collect_in_background = FALSE) {
as_polars_df.RPolarsLazyFrame(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
as_polars_df.RPolarsLazyFrame(
as_polars_df(

Not necessary since the class of x has to be RPolarsLazyFrame

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 intentional. I think it is worth being explicit, because if the argument to this function has an incorrect object (e.g., data.frame), an error will be generated and the bug will be noticed.

Copy link
Collaborator

@etiennebacher etiennebacher Feb 2, 2024

Choose a reason for hiding this comment

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

I don't understand your argument. If the arg x doesn't have the class RPolarsLazyFrame then calling as.data.frame() on it won't dispatch it to as.data.frame.RPolarsLazyFrame(). So putting .RPolarsLazyFrame inside the function is redundant because if as_polars_df() is called, it means we know it's a RPolarsLazyFrame. This is not very important though and I already approved the PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, you are right about this place, it may be redundant since there is no possibility that anything other than RPolarsLazyFrame will be entered.

inherit_optimization = inherit_optimization,
collect_in_background = collect_in_background
) |>
as.data.frame.RPolarsDataFrame(...)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
as.data.frame.RPolarsDataFrame(...)
as.data.frame(...)

same

@eitsupi eitsupi merged commit a711614 into main Feb 2, 2024
18 checks passed
@eitsupi eitsupi deleted the as.data.frame-more branch February 2, 2024 12:35
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.

None yet

2 participants