Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21807#discussion_r206019502
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
 ---
    @@ -68,9 +68,18 @@ trait CheckAnalysis extends PredicateHelper {
           case e if e.dataType != IntegerType => failAnalysis(
             s"The limit expression must be integer type, but got " +
               e.dataType.catalogString)
    -      case e if e.eval().asInstanceOf[Int] < 0 => failAnalysis(
    --- End diff --
    
    How about this:
    
    ```scala
    case e => e.eval() match {
      case null => failAnalysis(
        s"The evaluated limit expression must not be null, but got 
${limitExpr.sql}")
      case v: Int if v < 0 => failAnalysis(
        s"The limit expression must be equal to or greater than 0, but got $v")
      case _ => // OK
    }
    
    ```



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to