当前位置:首页 - Spark

Spark union算子学习使用详解

作者:高景洋 日期:2020-10-25 13:26:51 浏览次数:1792

union:

   合并两个RDD


示例代码:

def my_union():
    data = [1,2,3,4,5]
    rdd1 =sc.parallelize(data)
    data2 = [6,7,8,9,10]
    rdd2 = sc.parallelize(data2)
    result = rdd1.union(rdd2)
    print(result.collect())
输出结果:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]




本文永久性链接:
<a href="http://r4.com.cn/art154.aspx">Spark union算子学习使用详解</a>
当前header:Host: r4.com.cn X-Host1: r4.com.cn X-Host2: r4.com.cn X-Host3: 127.0.0.1:8080 X-Forwarded-For: 18.191.171.72 X-Real-Ip: 18.191.171.72 X-Domain: r4.com.cn X-Request: GET /art154.aspx HTTP/1.1 X-Request-Uri: /art154.aspx Connection: close Accept: */* User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com) Accept-Encoding: gzip, br, zstd, deflate