cloud-fan commented on code in PR #43910:
URL: https://github.com/apache/spark/pull/43910#discussion_r1412076685


##########
sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4:
##########
@@ -975,6 +975,7 @@ primaryExpression
     | LEFT_PAREN query RIGHT_PAREN                                             
                #subqueryExpression
     | functionName LEFT_PAREN (setQuantifier? argument+=functionArgument
        (COMMA argument+=functionArgument)*)? RIGHT_PAREN
+       (WITHIN GROUP LEFT_PAREN ORDER BY sortItem RIGHT_PAREN)?

Review Comment:
   https://www.postgresql.org/docs/9.4/functions-aggregate.html
   
   So the WITHIN GROUP can have multiple order by items. We should allow it in 
the parser and can fail for certain functions that only allow one sort order.
   <img width="1593" alt="image" 
src="https://github.com/apache/spark/assets/3182036/e53ebb9f-7f91-4a37-b843-9f8ebd4406d3";>
   



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