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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala:
##########
@@ -138,3 +138,29 @@ object SpecialDatetimeValues extends Rule[LogicalPlan] {
     }
   }
 }
+
+/**
+ * Validate whether the [[Offset]] is valid.
+ */
+object CheckOffsetOperator extends Rule[LogicalPlan] {
+  def apply(plan: LogicalPlan): LogicalPlan = {
+    plan.foreachUp {
+      case o if !o.isInstanceOf[GlobalLimit] && !o.isInstanceOf[LocalLimit]
+        && o.children.exists(_.isInstanceOf[Offset]) =>
+        throw new IllegalStateException(

Review Comment:
   This is a user-facing error, we should use `AnalysisException`



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