1.Wordcount.scala(本地模式) package com.Mars.spark import org.apache.spark.{SparkConf, SparkContext} /** * Created by Mars on 2017/1/11. */ object Wordcount { def main(args: Array[String]) { val conf = new SparkConf().setAppName("SparkwordcountApp")…
一.使用数据 Apache Spark is a fast and general-purpose cluster computing system.It provides high-level APIs in Java, Scala, Python and R, and an optimized engine that supports general execution graphs. It also supports a rich set of higher-level tools inc…
val conf: SparkConf = new SparkConf().setMaster(Local[*]).setAppName("wordCount") val sc=new SparkContext(conf) sc.textFile("/input").flatMap(" ").map((_,1)).reduceByKey(_+_).saveAsTextFile("/output") sc.stop val co…