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

Support reframe() #1148

Closed
mgirlich opened this issue Feb 10, 2023 · 3 comments
Closed

Support reframe() #1148

mgirlich opened this issue Feb 10, 2023 · 3 comments

Comments

@mgirlich
Copy link
Collaborator

Not quite sure how to handle this.

  • mutate() doesn't have the constraint on the number of rows, e.g. when using the SQL function unnest() it can increase/decrease the number of rows
  • for the SQL translation it is necessary to know whether a verb is like mutate() or summarise() to decide whether to use a window function or not
  • or should it simply throw an unsupported error?
@DavisVaughan
Copy link
Member

One of the reasons for putting reframe() in a separate function from summarise() was that dbplyr could just say "we don't support reframe() because that isn't something most data bases can do"

That could be the default behavior, with some restrictions lifted if a data base does have those capabilities?

@mgirlich
Copy link
Collaborator Author

Actually, SELECT itself doesn't really care about how many rows are returned. I think there are 2 situations:

  1. an aggregation function is used: every expression in SELECT must create 1 row per group
  2. no aggregation function: do whatever you want. One example is UNNEST() or GENERATE_SERIES() which would be the right fit for reframe(). And these functions are now very common.

With the recent dplyr version SQL now feels very limited and not expressive... In particular, I love the new safety for joins with unmatched and multiple.

@mgirlich
Copy link
Collaborator Author

Decided to simply not support reframe() for now. At least this gives a more informative error. The alternative would be to define reframe the same as summarise.
Closed by 0b2840a

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

No branches or pull requests

2 participants