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

Window function translation to SQL #176

Closed
jarodmeng opened this issue Aug 4, 2017 · 0 comments

Comments

@jarodmeng
Copy link
Contributor

commented Aug 4, 2017

Currently sd(), all() and any() window functions are translated to SQL using the following snippet.

    dbplyr::sql_translator(
      .parent = dbplyr::base_win,
      sd = dbplyr::win_recycled("sd"),
      all = dbplyr::win_recycled("all"),
      any = dbplyr::win_recycled("any"),
      ...
    )

This produces wrong SQL translation as sd() should be translated to STDDEV_SAMP(); all() to LOGICAL_AND() and any() to LOGICAL_OR().

Furthermore, BigQuery doesn't support OVER() clause for LOGICAL_AND() and LOGICAL_OR(). So all() and any() should be translated using win_absent() instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.