Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14034#discussion_r70183835
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 
---
    @@ -660,18 +660,51 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
     
       test("limit") {
         checkAnswer(
    -      sql("SELECT * FROM testData LIMIT 10"),
    +      sql("SELECT * FROM testData LIMIT 9 + 1"),
           testData.take(10).toSeq)
     
         checkAnswer(
    -      sql("SELECT * FROM arrayData LIMIT 1"),
    +      sql("SELECT * FROM arrayData LIMIT CAST(1 AS Integer)"),
           arrayData.collect().take(1).map(Row.fromTuple).toSeq)
     
         checkAnswer(
           sql("SELECT * FROM mapData LIMIT 1"),
           mapData.collect().take(1).map(Row.fromTuple).toSeq)
       }
     
    +  test("non-foldable expressions in LIMIT") {
    +    val e = intercept[AnalysisException] {
    +      sql("SELECT * FROM testData LIMIT key > 3")
    +    }.getMessage
    +    assert(e.contains("The argument to the LIMIT clause must evaluate to a 
constant value. " +
    +      "Limit:(testdata.`key` > 3)"))
    +  }
    +
    +  test("Limit: unable to evaluate and cast expressions in limit clauses to 
Int") {
    --- End diff --
    
    We should also update the test name, we don't try to cast the limit 
expression to int type.


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

Reply via email to