beliefer commented on code in PR #35975:
URL: https://github.com/apache/spark/pull/35975#discussion_r852503864
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -830,6 +848,30 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog {
check(plan)
}
+ /**
+ * Validate whether the [[Offset]] is valid.
+ */
+ private def checkOffsetOperator(plan: LogicalPlan): Unit = {
+ plan.foreachUp {
+ case o if !o.isInstanceOf[GlobalLimit] && !o.isInstanceOf[LocalLimit]
+ && o.children.exists(_.isInstanceOf[Offset]) =>
+ failAnalysis(
+ s"""
+ |The OFFSET clause is only allowed in the LIMIT clause, but the
OFFSET
+ |clause found in: ${o.nodeName}.""".stripMargin.replace("\n", "
"))
+ case _ =>
+ }
+ plan match {
+ case Offset(offsetExpr, _) =>
+ checkLimitLikeClause("offset", offsetExpr)
+ failAnalysis(
+ s"""
+ |The OFFSET clause is only allowed in the LIMIT clause, but the
OFFSET
+ |clause is found to be the outermost
node.""".stripMargin.replace("\n", " "))
+ case _ =>
+ }
Review Comment:
line 864 to line 871 used to find the outermost node. line 855 to line 862
can't help do this.
--
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]