Spark学习笔记
转贴请声明原文:http://blog.csdn.net/duck_genuine/article/details/40506715
join跟union方法测试效果
join(otherDataset, [numTasks]):(K, V) join (K, W) => (K, (V, W))
测试过如果 没有join到的key,就没有数据,也就是两个RDD没有共同的K,则没有相应的数据
如:
res15: Array[(Int, Int)] = Array((1,2), (2,3), (3,4))
res16: Array[(Int, Int)] = Array((1,2), (2,3), (4,5))
两个list 的join结果如下:
res17: Array[(Int, (Int, Int))] = Array((1,(2,2)), (2,(3,3)))
union(otherDataset) 返回一个新的数据集,由原数据集和参数联合而成
两个list 的 union结果如下:
res18: Array[(Int, Int)] = Array((1,2), (2,3), (3,4), (1,2), (2,3), (4,5))
暂时未测试map的
spark例子
https://github.com/apache/spark/tree/master/examples/src/main/scala/org/apache/spark/examples
XGraph 图计算
http://spark.apache.org/docs/latest/graphx-programming-guide.html#migrating-from-spark-091
spark streaming 流式计算
学习资料
http://shiyanjun.cn/archives/744.html
http://fossies.org/linux/spark/core/src/test/java/org/apache/spark/JavaAPISuite.java