Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10402#discussion_r48186892
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
 ---
    @@ -421,6 +460,19 @@ case class CumeDist() extends RowNumberLike with 
SizeBasedWindowFunction {
       override val evaluateExpression = Divide(Cast(rowNumber, DoubleType), 
Cast(n, DoubleType))
     }
     
    +/**
    + * The NTile function divides the rows for each window partition into 'n' 
buckets ranging from 1 to
    + * at most 'n'. Bucket values will differ by at most 1. If the number of 
rows in the partition does
    + * not divide evenly into the number of buckets, then the remainder values 
are distributed one per
    + * bucket, starting with the first bucket.
    + *
    + * The NTile function is particularly useful for the calculation of 
tertiles, quartiles, deciles and
    + * other common summary statistics
    + *
    + * @param buckets number of buckets to divide the rows in.
    + */
    +@ExpressionDescription(usage = "_FUNC_(x) - The NTILE(n) function divides 
the rows for each " +
    +  "window partition into 'n' buckets ranging from 1 to at most 'n'.")
     case class NTile(buckets: Expression) extends RowNumberLike with 
SizeBasedWindowFunction {
    --- End diff --
    
    Add some comments to explain the implementation of NTile?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to