Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/2874#discussion_r22738935
--- Diff: examples/src/main/scala/org/apache/spark/examples/SparkPi.scala
---
@@ -27,7 +27,7 @@ object SparkPi {
val conf = new SparkConf().setAppName("Spark Pi")
val spark = new SparkContext(conf)
val slices = if (args.length > 0) args(0).toInt else 2
- val n = 100000 * slices
+ val n = math.min(100000L * slices, Int.MaxValue -1).toInt
--- End diff --
maybe also add a quick comment at the end to explain why we're doing this:
```
val n = math.min(100000L * slices, Int.MaxValue).toInt // avoid overflow
```
---
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]