zoukankan      html  css  js  c++  java
  • spark:join与cogroup

    1.RDD[K,V],键值对类型的rdd的函数在PairRDDFunctions这个类中

    rdd类中,通过隐士转换让rdd有了PairRDDFunctions这个类里面方法的功能

     2.rdd 的join方式

    1.join=》rdd[k,v] join rdd[k,w]=》RDD[(K, (V, W))] 

    def join[W](other: RDD[(K, W)], partitioner: Partitioner): RDD[(K, (V, W))]
    2.leftOuterJoin 右边有可能是空的所有
    rdd[k,v] leftOuterJoin rdd[k,w]=》RDD[(K, (V, Option[W]))]
    def leftOuterJoin[W](other: RDD[(K, W)], partitioner: Partitioner): RDD[(K, (V, Option[W]))]
    3全join=》RDD[(K, (Option[V], Option[W]))]
    def fullOuterJoin[W]( other: RDD[(K, W)],numPartitions: Int): RDD[(K, (Option[V], Option[W]))]
    4.cogroup=》RDD[(K, (Iterable[V], Iterable[W]))]
    def cogroup[W](other: RDD[(K, W)], partitioner: Partitioner): RDD[(K, (Iterable[V], Iterable[W]))]

    join的底层调用cgroup算子

     3.cogroup算子

     测试看一下啥结果

  • 相关阅读:
    每日总结4.25
    每日总结4.24
    每日总结4.23
    每日博客4.22
    每日博客4.21
    每日博客4.20
    每日总结4.19
    每日总结4.16
    每日总结4.15
    每日总结4.14
  • 原文地址:https://www.cnblogs.com/hejunhong/p/12906231.html
Copyright © 2011-2022 走看看