GitHub user advancedxy opened a pull request:

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

    [Spark-5201] deal with int overflow in the ParallelCollectionRDD.slice 
method

    There is an int overflow in the ParallelCollectionRDD.slice method. That's 
originally reported by SaintBacchus. 
    ```
    sc.makeRDD(1 to (Int.MaxValue)).count       // result = 0
    sc.makeRDD(1 to (Int.MaxValue - 1)).count   // result = 2147483646 = 
Int.MaxValue - 1
    sc.makeRDD(1 until (Int.MaxValue)).count    // result = 2147483646 = 
Int.MaxValue - 1
    ```
    see https://github.com/apache/spark/pull/2874 for more details.
    This pr try to fix the overflow. However, There's another issue I don't 
address. 
    ```
    val largeRange = Int.MinValue to Int.MaxValue
    largeRange.length // throws java.lang.IllegalArgumentException: -2147483648 
to 2147483647 by 1: seqs cannot contain more than Int.MaxValue elements.
    ```
    
    So, the range we feed to sc.makeRDD cannot contain more than Int.MaxValue 
elements. This is the limitation of Scala. However I think  we may want to 
support that kind of range. But the fix is beyond this pr.
    
    @srowen @andrewor14 would you mind take a look at this pr?

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

    $ git pull https://github.com/advancedxy/spark SPARk-5201

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

    https://github.com/apache/spark/pull/4002.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 #4002
    
----
commit e66e60a9f2f37a7845ab09a165ee960f830d7b4e
Author: Ye Xianjin <[email protected]>
Date:   2015-01-12T07:23:39Z

    Deal with inclusive and exclusive ranges in one case. If the range is 
inclusive
    and the end of the range is (Int.MaxValue or Int.MinValue), we should use
    inclusive range instead of exclusive

commit 196f8a88ad7a26f285a74529303bd76aa46e9a25
Author: Ye Xianjin <[email protected]>
Date:   2015-01-12T07:28:45Z

    Add test cases for ranges end with Int.MaxValue or Int.MinValue

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to