mikhailnik-db commented on code in PR #48748:
URL: https://github.com/apache/spark/pull/48748#discussion_r1841991581


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -2216,21 +2216,25 @@ class Analyzer(override val catalogManager: 
CatalogManager) extends RuleExecutor
         numArgs: Int,
         u: UnresolvedFunction): Expression = {
       func match {
-        case owg: SupportsOrderingWithinGroup if u.isDistinct =>
+        case owg: InverseDistributionFunction if u.isDistinct =>
           throw 
QueryCompilationErrors.distinctInverseDistributionFunctionUnsupportedError(
             owg.prettyName)
-        case owg: SupportsOrderingWithinGroup
+        case owg: InverseDistributionFunction
           if !owg.orderingFilled && u.orderingWithinGroup.isEmpty =>

Review Comment:
   > But all inverse distribution functions support WITHIN GROUP (ORDER BY)?
   
   Yes, I just don't want to change the error messages.
   For some abstract extender of the `SupportsOrderingWithinGroup` trait that 
always wants to have `WITHIN GROUP`, the error should not be 
`INVALID_INVERSE_DISTRIBUTION_FUNCTION.WITHIN_GROUP_MISSING` but something like 
`INVALID_WITHIN_GROUP_EXPRESSION.WITHIN_GROUP_MISSING`. So I saw 2 options and 
chose the first: 
   1. Extract inverse distribution functions into special traits and save these 
narrow error classes.
   2. Add a flag in `SupportsOrderingWithinGroup` and rename 
`INVALID_INVERSE_DISTRIBUTION_FUNCTION` -> `INVALID_WITHIN_GROUP_EXPRESSION`=> 
change errors for existing functions



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