App.scala 488 Bytes
Newer Older
1
package no.uninett
2 3
import org.apache.spark.SparkContext
import org.apache.spark.SparkConf
4 5 6 7 8 9 10 11

/**
 * Hello world!
 *
 */
object App 
{
    def main(args: Array[String]):Unit={
12 13 14 15 16 17
        val appName = "scala test"
        val conf = new SparkConf().setAppName(appName).setMaster("local")
        val sc = new org.apache.spark.SparkContext(conf)
        val data = Array(1, 2, 3, 4, 5)
        val distData = sc.parallelize(data)
        distData.map(x => x + 1).reduce((x, y) => x + y)
18 19
    }
}