GitHub user maropu opened a pull request:

    https://github.com/apache/spark/pull/19401

    [SPARK-22176][SQL] Fix overflow issue in Dataset.show

    ## What changes were proposed in this pull request?
    This pr fixed an overflow issue below in `Dataset.show`:
    ```
    scala> Seq((1, 2), (3, 4)).toDF("a", "b").show(Int.MaxValue)
    org.apache.spark.sql.AnalysisException: The limit expression must be equal 
to or greater than 0, but got -2147483648;;
    GlobalLimit -2147483648
    +- LocalLimit -2147483648
       +- Project [_1#27218 AS a#27221, _2#27219 AS b#27222]
          +- LocalRelation [_1#27218, _2#27219]
    
      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$class.failAnalysis(CheckAnalysis.scala:41)
      at 
org.apache.spark.sql.catalyst.analysis.Analyzer.failAnalysis(Analyzer.scala:89)
      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$class.org$apache$spark$sql$catalyst$analysis$CheckAnalysis$$checkLimitClause(CheckAnalysis.scala:70)
      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1.apply(CheckAnalysis.scala:234)
      at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1.apply(CheckAnalysis.scala:80)
      at 
org.apache.spark.sql.catalyst.trees.TreeNode.foreachUp(TreeNode.scala:127)
    ```
    
    ## How was this patch tested?
    Added tests in `DataFrameSuite`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/maropu/spark MaxValueInShowString

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/19401.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #19401
    
----
commit f988766d2d798dd18683da24500ff03065471d4c
Author: Takeshi Yamamuro <[email protected]>
Date:   2017-09-30T09:21:12Z

    Fix overflow issue in Dataset.show

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to