beliefer commented on a change in pull request #35531:
URL: https://github.com/apache/spark/pull/35531#discussion_r816384851
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1835,11 +1835,18 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef]
with SQLConfHelper with Logg
override def visitPercentile(ctx: PercentileContext): Expression =
withOrigin(ctx) {
val percentage = expression(ctx.percentage)
val sortOrder = visitSortItem(ctx.sortItem)
- val percentile = sortOrder.direction match {
- case Ascending => new Percentile(sortOrder.child, percentage)
- case Descending => new Percentile(sortOrder.child, Subtract(Literal(1),
percentage))
Review comment:
Yes. According the document, only could specify partition by clause in
window.
I tested in Oracle
```
SELECT
percentile_cont(0.25) WITHIN GROUP (ORDER BY x) OVER (ORDER BY x ROWS
BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),
percentile_cont(0.25) WITHIN GROUP (ORDER BY x DESC) OVER (PARTITION BY k)
FROM SYSTEM.testRegression
ORDER BY k;
```
, it throws `SQL 错误 [30487] [99999]: ORA-30487: 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]