From cadb8de6a02a64364916fb41fea83f9a55830218 Mon Sep 17 00:00:00 2001 From: anabranch Date: Sun, 8 Jan 2017 09:16:01 -0800 Subject: [PATCH 1/2] updated docs --- R/pkg/R/functions.R | 6 ++++-- python/pyspark/sql/functions.py | 16 ++++++++++------ .../scala/org/apache/spark/sql/functions.scala | 16 ++++++++++------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index bf5c96373c632..122f5474709bc 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -3150,7 +3150,8 @@ setMethod("cume_dist", #' The difference between rank and dense_rank is that dense_rank leaves no gaps in ranking #' sequence when there are ties. That is, if you were ranking a competition using dense_rank #' and had three people tie for second place, you would say that all three were in second -#' place and that the next person came in third. +#' place and that the next person came in third. Rank would give me sequential numbers, making +#' the person that came in third place (after the ties) would register as coming in fifth. #' #' This is equivalent to the \code{DENSE_RANK} function in SQL. #' @@ -3324,7 +3325,8 @@ setMethod("percent_rank", #' The difference between rank and denseRank is that denseRank leaves no gaps in ranking #' sequence when there are ties. That is, if you were ranking a competition using denseRank #' and had three people tie for second place, you would say that all three were in second -#' place and that the next person came in third. +#' place and that the next person came in third. Rank would give me sequential numbers, making +#' the person that came in third place (after the ties) would register as coming in fifth. #' #' This is equivalent to the RANK function in SQL. #' diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index d8abafcde3846..7fe901a4fbbaf 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -157,17 +157,21 @@ def _(): 'dense_rank': """returns the rank of rows within a window partition, without any gaps. - The difference between rank and denseRank is that denseRank leaves no gaps in ranking - sequence when there are ties. That is, if you were ranking a competition using denseRank + The difference between rank and dense_rank is that dense_rank leaves no gaps in ranking + sequence when there are ties. That is, if you were ranking a competition using dense_rank and had three people tie for second place, you would say that all three were in second - place and that the next person came in third.""", + place and that the next person came in third. Rank would give me sequential numbers, making + the person that came in third place (after the ties) would register as coming in fifth. + + This is equivalent to the DENSE_RANK function in SQL.""", 'rank': """returns the rank of rows within a window partition. - The difference between rank and denseRank is that denseRank leaves no gaps in ranking - sequence when there are ties. That is, if you were ranking a competition using denseRank + The difference between rank and dense_rank is that dense_rank leaves no gaps in ranking + sequence when there are ties. That is, if you were ranking a competition using dense_rank and had three people tie for second place, you would say that all three were in second - place and that the next person came in third. + place and that the next person came in third. Rank would give me sequential numbers, making + the person that came in third place (after the ties) would register as coming in fifth. This is equivalent to the RANK function in SQL.""", 'cume_dist': diff --git a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala b/sql/core/src/main/scala/org/apache/spark/sql/functions.scala index 650439a193015..9a080fd3c97c1 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/functions.scala @@ -785,10 +785,13 @@ object functions { /** * Window function: returns the rank of rows within a window partition, without any gaps. * - * The difference between rank and denseRank is that denseRank leaves no gaps in ranking - * sequence when there are ties. That is, if you were ranking a competition using denseRank + * The difference between rank and dense_rank is that denseRank leaves no gaps in ranking + * sequence when there are ties. That is, if you were ranking a competition using dense_rank * and had three people tie for second place, you would say that all three were in second - * place and that the next person came in third. + * place and that the next person came in third. Rank would give me sequential numbers, making + * the person that came in third place (after the ties) would register as coming in fifth. + * + * This is equivalent to the DENSE_RANK function in SQL. * * @group window_funcs * @since 1.6.0 @@ -929,10 +932,11 @@ object functions { /** * Window function: returns the rank of rows within a window partition. * - * The difference between rank and denseRank is that denseRank leaves no gaps in ranking - * sequence when there are ties. That is, if you were ranking a competition using denseRank + * The difference between rank and dense_rank is that dense_rank leaves no gaps in ranking + * sequence when there are ties. That is, if you were ranking a competition using dense_rank * and had three people tie for second place, you would say that all three were in second - * place and that the next person came in third. + * place and that the next person came in third. Rank would give me sequential numbers, making + * the person that came in third place (after the ties) would register as coming in fifth. * * This is equivalent to the RANK function in SQL. * From 5ef5958811b63b508839ae5e952a5279270ba37a Mon Sep 17 00:00:00 2001 From: anabranch Date: Sun, 8 Jan 2017 15:41:28 -0800 Subject: [PATCH 2/2] address comments for R --- R/pkg/R/functions.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index 122f5474709bc..6ffa0f5481c65 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -3322,8 +3322,8 @@ setMethod("percent_rank", #' #' Window function: returns the rank of rows within a window partition. #' -#' The difference between rank and denseRank is that denseRank leaves no gaps in ranking -#' sequence when there are ties. That is, if you were ranking a competition using denseRank +#' The difference between rank and dense_rank is that dense_rank leaves no gaps in ranking +#' sequence when there are ties. That is, if you were ranking a competition using dense_rank #' and had three people tie for second place, you would say that all three were in second #' place and that the next person came in third. Rank would give me sequential numbers, making #' the person that came in third place (after the ties) would register as coming in fifth.