zoukankan      html  css  js  c++  java
  • RDD的转换操作---RDD转换过程

    1) union(otherRDD)
    RDD-->UnionRDD
    2) groupByKey(numPartitions)
    RDD-->ShuffledRDD-->MapPartitionsRDD
    groupByKey() 只需要将 Key 相同的 records 聚合在一起,一个简单的 shuffle 过程就可以完成。
    3) reduceyByKey(func, numPartitions)
    reduceyByKey() 相当于传统的 MapReduce
    RDD-->MapPartitionsRDD-->ShuffledRDD-->MapPartitionsRDD
    4) distinct(numPartitions)
    RDD-->MappedRDD-->MapPartitionsRDD-->ShuffledRDD-->MapPartitionsRDD
    distinct() 功能是 deduplicate RDD 中的所有的重复数据。
    5) cogroup(otherRDD, numPartitions)
    RDD-->CogroupRDD-->MapPartitionsRDD
    与 groupByKey() 不同,cogroup() 要 aggregate 两个或两个以上的 RDD
    6) intersection(otherRDD)
    RDD-->MappedRDD-->CogroupRDD-->MappedValuesRDD-->FilteredRDD-->MappedRDD
    intersection() 功能是抽取出 RDD a 和 RDD b 中的公共数据。
    7) join(otherRDD, numPartitions)
    RDD-->CogroupRDD-->MappedValuesRDD-->FlatMappedValuesRDD
    join() 将两个 RDD[(K, V)] 按照 SQL 中的 join 方式聚合在一起。
    8) sortByKey(ascending, numPartitions)
    RDD-->ShuffledRDD-->MapPartitionsRDD
    sortByKey() 将 RDD[(K, V)] 中的 records 按 key 排序,ascending = true 表示升序,false 表示降序。
    9) cartesian(otherRDD)
    RDD-->CartesianRDD
    Cartesian 对两个 RDD 做笛卡尔集,生成的 CartesianRDD 中 partition 个数 = partitionNum(RDD a) * partitionNum(RDD b)。

  • 相关阅读:
    mpstat 查看多核CPU负载状态
    redis pipeset发布订阅
    sqlalchemyorm学生签到 成绩记录查询系统
    ORM数据库命令操作包装实例对象学习
    Python Mysql数据库操作
    redis hash操作 list列表操作
    pymysqlsqlalchemyorm
    ss命令用来显示处于活动状态的套接字信息。
    8月20日学习日志
    8月22日学习日志
  • 原文地址:https://www.cnblogs.com/liutoutou/p/4063403.html
Copyright © 2011-2022 走看看