摘要:
join leftOuterjoin rightOuterJoin cogroup scala> var arr = Array(("zhangsan",200),("lisi",300),("wangwu",350)) arr: Array[(String, Int)] = Array((zhan 阅读全文
posted @ 2019-08-06 15:14
鹦鹉英冠
阅读(138)
评论(0)
推荐(0)
摘要:
map遍历每一个元素 mapPartitions每次遍历一个分区 foreach action算子 foreachPartitions action算子 collect nginx flume hdfs hbase spark mysql 如果是插入数据,那么foreachPartition比较好, 阅读全文
posted @ 2019-08-06 15:08
鹦鹉英冠
阅读(148)
评论(0)
推荐(0)
摘要:
自定义资源分配 --executor-cores --executor-memory --total-executor-cores 最大允许使用多少核数 3台机器 每个机器8cores 1G --executor-cores --executor-memory --total-executor-co 阅读全文
posted @ 2019-08-06 15:06
鹦鹉英冠
阅读(137)
评论(0)
推荐(0)
摘要:
spark得课程体系 sparkcore:spark得核心 sparksql底层使用得是sparkcore将sql解析为core阶段得任务,进行执行 spark-streaming定时执行sparkcore阶段得任务 spark得安装集群模式 spark任务得提交 spark-submit提交一个j 阅读全文
posted @ 2019-08-06 15:04
鹦鹉英冠
阅读(189)
评论(0)
推荐(0)
摘要:
作业 object Test234 { def main(args: Array[String]): Unit = { val data:Iterator[String] = Source.fromFile("app.txt").getLines() val data1:Iterator[((Str 阅读全文
posted @ 2019-08-06 15:00
鹦鹉英冠
阅读(326)
评论(0)
推荐(0)
摘要:
option的匹配 val map = Map(("zhangsan",2000),("lisi",2500),("wangwu",3000))val option:Any = map.get("zhangsan")option match { case Some(v) =>println(v) c 阅读全文
posted @ 2019-08-06 14:57
鹦鹉英冠
阅读(142)
评论(0)
推荐(0)
摘要:
辅助构造器的声明 class tobacco(var logo:String,smell:String,price:Double){ var count:Int = _ def this(){ //辅助构造器的第一行内容必须调用构造器 this(logo,smell,price) } def thi 阅读全文
posted @ 2019-08-06 14:56
鹦鹉英冠
阅读(148)
评论(0)
推荐(0)
摘要:
练习 object HomeWorke232424r { def main(args: Array[String]): Unit = { val d1 = Array(("bj", 28.1), ("sh", 28.7), ("gz", 32.0), ("sz", 33.1)) val d2 = A 阅读全文
posted @ 2019-08-06 14:55
鹦鹉英冠
阅读(172)
评论(0)
推荐(0)
摘要:
元组Tuple Array ArrayByfffer List ListBuffer Map HashMap Set scala.collection.mutable._ sorted sortBy sortwith scala> import scala.collection._ import s 阅读全文
posted @ 2019-08-06 14:54
鹦鹉英冠
阅读(166)
评论(0)
推荐(0)
摘要:
函数得定义 val funtionName=(param:ParamType...)=>{} 这种定义方式没有返回值类型,会自己进行适配 函数在scala中可以任务是一个可以使用得值 函数在放置得时候会显示签名信息,描述当前函数得一个描述信息文件 eg:在scala中存在三种类型 class类 ob 阅读全文
posted @ 2019-08-06 14:53
鹦鹉英冠
阅读(152)
评论(0)
推荐(0)
摘要:
函数function 0-22 元组tuple 不可变的总共存在Tuple1-22 22个元组取值的时候按照元素的名称取值_1到_N两个元素的元组就是对偶元组 zipWithIndex与下标进行拉链Array是长度不可变,但是元素可变ArrayBuffer长度和元素都可以变化import scala 阅读全文
posted @ 2019-08-06 14:52
鹦鹉英冠
阅读(96)
评论(0)
推荐(0)
摘要:
1.flatten可以把嵌套的结构展开. scala> List(List(1,2),List(3,4)).flattenres0: List[Int] = List(1, 2, 3, 4)2、flatmapflatMap结合了map和flatten的功能。接收一个可以处理嵌套列表的函数,然后把返回 阅读全文
posted @ 2019-08-06 14:30
鹦鹉英冠
阅读(526)
评论(0)
推荐(0)

浙公网安备 33010602011771号