Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/14034#discussion_r70183276 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala --- @@ -46,6 +46,21 @@ trait CheckAnalysis extends PredicateHelper { }).length > 1 } + private def checkLimitClause(limitExpr: Expression): Unit = { + if (!limitExpr.foldable) { + failAnalysis( + "The argument to the LIMIT clause must evaluate to a constant value. " + + s"Limit:${limitExpr.sql}") + } + limitExpr.eval() match { + case o: Int if o >= 0 => // OK + case o: Int => failAnalysis( + s"number_rows in limit clause must be equal to or greater than 0. number_rows:$o") + case o => failAnalysis( + s"""number_rows in limit clause cannot be cast to integer:\"$o\".""") --- End diff -- Thanks!
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org