摘要: 一 简介 Shuffle,简而言之,就是对数据进行重新分区,其中会涉及大量的网络io和磁盘io,为什么需要shuffle,以词频统计reduceByKey过程为例, serverA:partition1: (hello, 1), (word, 1)serverB:partition2: (hello 阅读全文
posted @ 2018-12-21 18:54 匠人先生 阅读(1762) 评论(0) 推荐(1)
摘要: spark中要将计算结果取回driver,有两种方式:collect和take,这两种方式有什么差别?来看代码: org.apache.spark.rdd.RDD /** * Return an array that contains all of the elements in this RDD. 阅读全文
posted @ 2018-12-21 14:56 匠人先生 阅读(2430) 评论(0) 推荐(1)
摘要: 之前讨论过hive中limit的实现,详见 https://www.cnblogs.com/barneywill/p/10109217.html下面看spark sql中limit的实现,首先看执行计划: spark-sql> explain select * from test1 limit 10 阅读全文
posted @ 2018-12-21 14:36 匠人先生 阅读(3626) 评论(0) 推荐(0)
摘要: 最近把一些sql执行从hive改到spark,发现执行更慢,sql主要是一些insert overwrite操作,从执行计划看到,用到InsertIntoHiveTable spark-sql> explain insert overwrite table test2 select * from t 阅读全文
posted @ 2018-12-21 11:45 匠人先生 阅读(8586) 评论(1) 推荐(1)
摘要: spark on yarn通过--deploy-mode cluster提交任务之后,应用已经在yarn上执行了,但是spark-submit提交进程还在,直到应用执行结束,提交进程才会退出,有时这会很不方便,并且不注意的话还会占用很多资源,比如提交spark streaming应用; 最近发现sp 阅读全文
posted @ 2018-12-21 11:15 匠人先生 阅读(2946) 评论(0) 推荐(0)
摘要: 最近在hdfs写文件的时候发现一个问题,create写入正常,append写入报错,每次都能重现,代码示例如下: FileSystem fs = FileSystem.get(conf); OutputStream out = fs.create(file); IOUtils.copyBytes(i 阅读全文
posted @ 2018-12-21 11:08 匠人先生 阅读(1461) 评论(0) 推荐(0)