变量的定义 val a: Int = 1 var b = 2 方法和函数 区别:函数可以作为参数传递给方法 方法: def test(arg: Int): Int=>Int ={ 方法体 } val fun = (test _: Int =>(Int=>Int))=>函数体 逻辑执行语句 val a = if(条件){ 执行逻辑 返回值 }else{ 执行逻辑 } while(条件){ 执行逻辑 } val arr = Array(1,2,3,4,5) for(i <- 0…
import org.apache.spark.{SparkConf, SparkContext}/** * Created by loushsh on 2017/10/9. */object WordCount { def main(args:Array[String]): Unit ={ val conf=new SparkConf() val sc=new SparkContext(conf) val line= sc.textFile(args(0)) val count=line.fl…
首先是一张Spark的部署图: 节点类型有: 1. master 节点: 常驻master进程,负责管理全部worker节点.2. worker 节点: 常驻worker进程,负责管理executor 并与master节点通信.dirvier:官方解释为: The process running the main() function of the application and creating the SparkContext.即理解为用户自己编写的应用程序 一.Application ap…