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/03/31 01:36:49 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #36003: [SPARK-38685][SQL] Improve the implement of percentile_cont

cloud-fan commented on a change in pull request #36003:
URL: https://github.com/apache/spark/pull/36003#discussion_r839098559



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1836,11 +1836,12 @@ class AstBuilder extends SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit
   override def visitPercentile(ctx: PercentileContext): Expression = withOrigin(ctx) {
     val percentage = expression(ctx.percentage)
     val sortOrder = visitSortItem(ctx.sortItem)
-    val percentileCont = sortOrder.direction match {
-      case Ascending => PercentileCont(sortOrder.child, percentage)
-      case Descending => PercentileCont(sortOrder.child, Subtract(Literal(1), percentage))
+    val percentile = sortOrder.direction match {
+      case Ascending => new Percentile(sortOrder.child, percentage)
+      case Descending => new Percentile(sortOrder.child, Subtract(Literal(1), percentage))
     }
-    val aggregateExpression = percentileCont.toAggregateExpression()
+    percentile.setTagValue(Percentile.IS_ORDERED_SET, true)

Review comment:
       Can we reuse `FunctionRegistry.FUNC_ALIAS`? Then we can simply check `Percentile.prettyName` in `CheckAnalysis`




-- 
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