【问题标题】:Joining data sets in Spark在 Spark 中加入数据集
【发布时间】:2015-12-23 06:13:55
【问题描述】:

在 Spark 中加入数据有哪些不同的方法?

Hadoop map reduce 提供 - 分布式缓存、map side join 和 reduce side join。 Spark 呢?

如果您可以提供简单的 scala 和 python 代码来连接 Spark 中的数据集,那将是非常棒的。

【问题讨论】:

标签: python scala apache-spark


【解决方案1】:

Spark 有两个基本的分布式数据对象。数据框和 RDD。

RDD 的一种特殊情况,在这种情况下两者都是对,可以在它们的键上连接。这可以使用PairRDDFunctions.join() 获得。见:https://spark.apache.org/docs/1.5.2/api/scala/index.html#org.apache.spark.rdd.PairRDDFunctions

Dataframes 也允许类似 SQL 的连接。见:http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.DataFrame

【讨论】:

    猜你喜欢
    • 2016-07-27
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    • 2020-08-21
    • 2018-12-19
    • 1970-01-01
    • 2018-06-01
    • 2020-04-10
    相关资源
    最近更新 更多