You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/26 03:07:23 UTC

[GitHub] [spark] beliefer commented on a change in pull request #35531: [SPARK-38219][SQL] Support ANSI aggregation function `percentile_cont` as window function

beliefer commented on a change in pull request #35531:
URL: https://github.com/apache/spark/pull/35531#discussion_r815258699



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1835,11 +1835,18 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with SQLConfHelper with Logg
   override def visitPercentile(ctx: PercentileContext): Expression = withOrigin(ctx) {
     val percentage = expression(ctx.percentage)
     val sortOrder = visitSortItem(ctx.sortItem)
-    val percentile = sortOrder.direction match {
-      case Ascending => new Percentile(sortOrder.child, percentage)
-      case Descending => new Percentile(sortOrder.child, Subtract(Literal(1), percentage))

Review comment:
       Because cannot specify order by or frame of window for 'PERCENTILE_CONT'.
   ```
                 case AggregateExpression(_: PercentileCont, _, _, _, _)
                    if w.windowSpec.orderSpec.nonEmpty || w.windowSpec.frameSpecification !=
                        SpecifiedWindowFrame(RowFrame, UnboundedPreceding, UnboundedFollowing) =>
                    failAnalysis("Cannot specify order by or frame for 'PERCENTILE_CONT'.")
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org