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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to