cloud-fan commented on code in PR #48413:
URL: https://github.com/apache/spark/pull/48413#discussion_r1799120398
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -1010,21 +1018,44 @@ class AstBuilder extends DataTypeAstBuilder
// [EMPTY]
query
} else {
- throw
QueryParsingErrors.combinationQueryResultClausesUnsupportedError(ctx)
+ val allClauses = "ORDER BY/SORT BY/DISTRIBUTE BY/CLUSTER BY"
+ if (forPipeOperators) {
+ throw QueryParsingErrors.clausesWithPipeOperatorsUnsupportedError(ctx,
allClauses)
+ } else {
+ throw
QueryParsingErrors.combinationQueryResultClausesUnsupportedError(ctx,
allClauses)
+ }
}
// WINDOWS
- val withWindow = withOrder.optionalMap(windowClause)(withWindowClause)
+ val withWindow = withOrder.optionalMap(windowClause) {
+ withWindowClause
+ }
+ if (forPipeOperators && windowClause != null) {
+ throw QueryParsingErrors.clausesWithPipeOperatorsUnsupportedError(
+ ctx, s"the WINDOW clause")
+ }
// OFFSET
// - OFFSET 0 is the same as omitting the OFFSET clause
+ val offsetClause = "OFFSET"
val withOffset = withWindow.optional(offset) {
+ if (forPipeOperators && clause.nonEmpty) {
+ throw QueryParsingErrors.clausesWithPipeOperatorsUnsupportedError(
+ ctx, s"the $clause and $offsetClause clauses")
+ }
+ clause = offsetClause
Offset(typedVisit(offset), withWindow)
}
// LIMIT
// - LIMIT ALL is the same as omitting the LIMIT clause
withOffset.optional(limit) {
+ val limitClause = "LIMIT"
+ if (forPipeOperators && clause.nonEmpty && clause != offsetClause) {
+ throw QueryParsingErrors.clausesWithPipeOperatorsUnsupportedError(
+ ctx, s"the $clause and $limitClause clauses")
Review Comment:
```suggestion
ctx, s"the co-existence of $clause and $limitClause clauses")
```
--
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]