摘要: spark08 这就是广播变量,每个executor中复用一份数据,在driver端将数据广播出去,在executor端使用 val bd = sc.broadcast(iparr)val proRDD = accRDD.map(t=>{ val province = binarySeach(t,b 阅读全文
posted @ 2019-09-16 17:17 lilixia 阅读(261) 评论(0) 推荐(0) 编辑
摘要: spark07 spark运行原理: RDD Object driver提交代码,spark-submit运行main方法。但是没有真正执行,初始化driver端得组件DAGScheduler TaskScheduler SchedulerBackEnd.saveAsTextFile出发,DAGSc 阅读全文
posted @ 2019-09-16 17:13 lilixia 阅读(134) 评论(0) 推荐(0) 编辑
摘要: spark06 总共提交的任务分为四个阶段,提交+执行 从spark-submit开始,剖析所有的运行流行(重点,重点,重点) spark-submit方法的时候,SparkSubmit 类 spark-submit --master xxx --class xxx --name xxx xxx.j 阅读全文
posted @ 2019-09-16 15:10 lilixia 阅读(232) 评论(0) 推荐(0) 编辑
摘要: spark05 def main(args: Array[String]): Unit = { //每个用户最喜欢得电影类型 //观看量 评分得平均值 val conf = new SparkConf() conf.setMaster("local[*]") conf.setAppName("mov 阅读全文
posted @ 2019-09-16 15:04 lilixia 阅读(208) 评论(0) 推荐(0) 编辑
摘要: spark04 join leftOuterjoin rightOuterJoin cogroup scala> var arr = Array(("zhangsan",200),("lisi",300),("wangwu",350)) arr: Array[(String, Int)] = Arr 阅读全文
posted @ 2019-09-16 14:58 lilixia 阅读(199) 评论(0) 推荐(0) 编辑
摘要: spark03 map遍历每一个元素 mapPartitions每次遍历一个分区 foreach action算子 foreachPartitions action算子 collect nginx flume hdfs hbase spark mysql 如果是插入数据,那么foreachParti 阅读全文
posted @ 2019-09-16 14:49 lilixia 阅读(198) 评论(0) 推荐(0) 编辑
摘要: spark02 自定义资源分配 --executor-cores --executor-memory --total-executor-cores 最大允许使用多少核数 3台机器 每个机器8cores 1G --executor-cores --executor-memory --total-exe 阅读全文
posted @ 2019-09-16 14:47 lilixia 阅读(246) 评论(0) 推荐(0) 编辑
摘要: spark01 spark的特点 搭建spark的集群 提交spark的任务 spark的运行机制 spark wordcount spark的官网spark.apache.org spark运行速度比较快:因为使用内存 mr存在昂贵的shuffle mr 只有两个算子 (map reduce)*N 阅读全文
posted @ 2019-09-16 14:41 lilixia 阅读(227) 评论(0) 推荐(0) 编辑
摘要: object Test234 { def main(args: Array[String]): Unit = { val data:Iterator[String] = Source.fromFile("app.txt").getLines() val data1:Iterator[((String 阅读全文
posted @ 2019-09-16 14:36 lilixia 阅读(268) 评论(0) 推荐(0) 编辑
摘要: scala05课件 辅助构造器的声明 class tobacco(var logo:String,smell:String,price:Double){ var count:Int = _ def this(){ //辅助构造器的第一行内容必须调用构造器 this(logo,smell,price) 阅读全文
posted @ 2019-09-16 14:32 lilixia 阅读(171) 评论(0) 推荐(0) 编辑
摘要: scala06 option的匹配 val map = Map(("zhangsan",2000),("lisi",2500),("wangwu",3000))val option:Any = map.get("zhangsan")option match { case Some(v) =>prin 阅读全文
posted @ 2019-09-16 14:32 lilixia 阅读(113) 评论(0) 推荐(0) 编辑
摘要: scala04课件 作业题 object HomeWorke232424r { def main(args: Array[String]): Unit = { val d1 = Array(("bj", 28.1), ("sh", 28.7), ("gz", 32.0), ("sz", 33.1)) 阅读全文
posted @ 2019-09-16 14:31 lilixia 阅读(210) 评论(0) 推荐(0) 编辑
摘要: scala02课件 函数得定义 val funtionName=(param:ParamType...)=>{} 这种定义方式没有返回值类型,会自己进行适配 函数在scala中可以任务是一个可以使用得值 函数在放置得时候会显示签名信息,描述当前函数得一个描述信息文件 eg:在scala中存在三种类型 阅读全文
posted @ 2019-09-16 14:30 lilixia 阅读(266) 评论(0) 推荐(0) 编辑
摘要: scala03课件 元组Tuple Array ArrayByfffer List ListBuffer Map HashMap Set scala.collection.mutable._ sorted sortBy sortwith scala> import scala.collection. 阅读全文
posted @ 2019-09-16 14:30 lilixia 阅读(248) 评论(0) 推荐(0) 编辑