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