cloud-fan commented on code in PR #43910:
URL: https://github.com/apache/spark/pull/43910#discussion_r1412078992
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -2367,6 +2367,27 @@ class Analyzer(override val catalogManager:
CatalogManager) extends RuleExecutor
case agg: AggregateFunction =>
// Note: PythonUDAF does not support these advanced clauses.
if (agg.isInstanceOf[PythonUDAF])
checkUnsupportedAggregateClause(agg, u)
+ val newAgg = agg match {
+ case idf: SupportsOrderingWithinGroup if
u.orderingWithinGroup.isDefined =>
+ if (u.isDistinct) {
+ throw
QueryCompilationErrors.distinctInverseDistributionFunctionUnsupportedError(
+ idf.prettyName)
+ }
+ if (idf.isFake) {
+ idf.withOrderingWithinGroup(u.orderingWithinGroup.get)
+ } else {
+ idf
+ }
+ case idf: SupportsOrderingWithinGroup =>
+ throw
QueryCompilationErrors.inverseDistributionFunctionMissingWithinGroupError(
+ idf.prettyName)
+ case _ =>
+ if (u.orderingWithinGroup.isDefined) {
+ throw
QueryCompilationErrors.functionWithUnsupportedSyntaxError(
+ func.prettyName, "WITHIN GROUP (ORDER BY clause)")
Review Comment:
```suggestion
func.prettyName, "WITHIN GROUP (ORDER BY ...)")
```
--
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]