pyspark怎样给rdd添加一列新数据
作者:高景洋 日期:2021-01-13 16:30:50 浏览次数:3895
pyspark中要给rdd增加一列新数据,请看下边的代码。
from pyspark.sql import Row
def add_field(row,refresh_date):
tmp = row.asDict()
tmp['RefreshDate'] = refresh_date
tmp['RandomKey'] = uuid.uuid1().hex
return Row(**tmp)
if __name__ == '__main__':
rdd_data= hbase_rdd.map(lambd m:add_field(m[1],refresh_date)).collect()
本文永久性链接:
<a href="http://r4.com.cn/art171.aspx">pyspark怎样给rdd添加一列新数据</a>
<a href="http://r4.com.cn/art171.aspx">pyspark怎样给rdd添加一列新数据</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.220.55.82
X-Real-Ip: 18.220.55.82
X-Domain: r4.com.cn
X-Request: GET /art171.aspx HTTP/1.1
X-Request-Uri: /art171.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