mikhailnik-db commented on code in PR #48748:
URL: https://github.com/apache/spark/pull/48748#discussion_r1850252048
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionResolution.scala:
##########
@@ -128,18 +128,14 @@ class FunctionResolution(
numArgs: Int,
u: UnresolvedFunction): Expression = {
func match {
- case owg: SupportsOrderingWithinGroup if u.isDistinct =>
- throw
QueryCompilationErrors.distinctInverseDistributionFunctionUnsupportedError(
- owg.prettyName
- )
- case owg: SupportsOrderingWithinGroup
- if !owg.orderingFilled && u.orderingWithinGroup.isEmpty =>
- throw
QueryCompilationErrors.inverseDistributionFunctionMissingWithinGroupError(
- owg.prettyName
- )
+ case owg: SupportsOrderingWithinGroup if !owg.isDistinctSupported &&
u.isDistinct =>
+ throw
QueryCompilationErrors.distinctWithOrderingFunctionUnsupportedError(owg.prettyName)
case owg: SupportsOrderingWithinGroup
- if owg.orderingFilled && u.orderingWithinGroup.nonEmpty =>
- throw
QueryCompilationErrors.wrongNumOrderingsForInverseDistributionFunctionError(
+ if owg.isOrderingMandatory && !owg.orderingFilled &&
u.orderingWithinGroup.isEmpty =>
+ throw
QueryCompilationErrors.functionMissingWithinGroupError(owg.prettyName)
+ case owg: Mode if owg.orderingFilled && u.orderingWithinGroup.nonEmpty =>
Review Comment:
Maybe, but I don't like this behavior. It basically says "If a function got
the order in some non-standard way then forbid `WITHIN GROUP (ORDER BY)` for
it". I would prefer not to have functions that can bypass standard syntax. From
my perspective, it's more a functions-specific hack than a part of the
`SupportsOrderingWithinGroup` interface
--
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]