diff --git a/NAMESPACE b/NAMESPACE index c298c1fdc..a9bff8dd8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -580,6 +580,7 @@ export(win_current_group) export(win_current_order) export(win_over) export(win_rank) +export(win_rank_tdata) export(win_recycled) export(window_frame) export(window_order) diff --git a/R/backend-teradata.R b/R/backend-teradata.R index e9d8b4151..fe2007ee4 100644 --- a/R/backend-teradata.R +++ b/R/backend-teradata.R @@ -217,3 +217,26 @@ sql_table_analyze.Teradata <- function(con, table, ...) { } utils::globalVariables(c("ATAN2", "SUBSTR", "DECIMAL", "WEEKNUMBER_OF_YEAR", "SUM")) + +#' @export +#' @rdname win_over +win_rank_tdata <- function(f) { + lifecycle::deprecate_soft( + "2.4.0", + what = "win_rank_tdata()", + with = "win_rank()" + ) + + force(f) + function(order_by = NULL) { + order_by <- order_by %||% win_current_group() + if (is_empty(order_by)) order_by <- sql("(SELECT NULL)") + + win_over( + sql(glue("{f}()")), + partition = win_current_group(), + order = order_by, + frame = win_current_frame() + ) + } +} diff --git a/man/win_over.Rd b/man/win_over.Rd index 1c48a4e2f..39e1a5939 100644 --- a/man/win_over.Rd +++ b/man/win_over.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/translate-sql-window.R +% Please edit documentation in R/translate-sql-window.R, R/backend-teradata.R \name{win_over} \alias{win_over} \alias{win_rank} @@ -11,6 +11,7 @@ \alias{win_current_group} \alias{win_current_order} \alias{win_current_frame} +\alias{win_rank_tdata} \title{Generate SQL expression for window functions} \usage{ win_over( @@ -36,6 +37,8 @@ win_current_group() win_current_order() win_current_frame() + +win_rank_tdata(f) } \arguments{ \item{expr}{The window expression}