gt; From: "Andy Konwinski"
>> To: dev@spark.apache.org
>> Sent: Tuesday, May 20, 2014 4:06:33 PM
>> Subject: Re: Scala examples for Spark do not work as written in documentation
>>
>> I fixed the bug, but I kept the parameter "i" instead of "
val x = Math.random()
> > >> ^
> > >>
> > >> If I rewrite the query slightly, adding in {}, it works:
> > >>
> > >> val count = spark.parallelize(1 to 1).map(i =>
> > >>{
> > >>val x = Math.random()
> > >>val y = Math.random()
> > >>if (x*x + y*y < 1) 1 else 0
> > >>}
> > >> ).reduce(_ + _)
> > >> println("Pi is roughly " + 4.0 * count / 1.0)
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >>
> > http://apache-spark-developers-list.1001551.n3.nabble.com/Scala-examples-for-Spark-do-not-work-as-written-in-documentation-tp6593.html
> > >> Sent from the Apache Spark Developers List mailing list archive at
> > >> Nabble.com.
> > >>
> > >
> > >
> >
>
^
> >>
> >> If I rewrite the query slightly, adding in {}, it works:
> >>
> >> val count = spark.parallelize(1 to 10000).map(i =>
> >> {
> >>val x = Math.random()
> >>val y = Math.random()
> >>if (x*x + y*y
not-be-arbitrary-function-td6606.html
--
View this message in context:
http://apache-spark-developers-list.1001551.n3.nabble.com/Scala-examples-for-Spark-do-not-work-as-written-in-documentation-tp6593p6607.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.
>> ).reduce(_ + _)
>> println("Pi is roughly " + 4.0 * count / 1.0)
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-developers-list.1001551.n3.nabble.com/Scala-examples-for-Spark-do-not-work-as-written-in-documentation-tp6593.html
>> Sent from the Apache Spark Developers List mailing list archive at
>> Nabble.com.
>>
>
>
unt = spark.parallelize(1 to 1).map(i =>
>{
>val x = Math.random()
>val y = Math.random()
>if (x*x + y*y < 1) 1 else 0
>}
> ).reduce(_ + _)
> println("Pi is roughly " + 4.0 * count / 10000.0)
>
>
>
>
>
> --
> View t
count / 1.0)
>
>
>
>
>
> --
> View this message in context:
> http://apache-spark-developers-list.1001551.n3.nabble.com/Scala-examples-for-Spark-do-not-work-as-written-in-documentation-tp6593.html
> Sent from the Apache Spark Developers List mailing list archive at
> Nabble.com.
>
h.random()
val y = Math.random()
if (x*x + y*y < 1) 1 else 0
}
).reduce(_ + _)
println("Pi is roughly " + 4.0 * count / 1.0)
--
View this message in context:
http://apache-spark-developers-list.1001551.n3.nabble.com/Scala-examples-for-Spark-do-not-work-as-written-in-documentation-