清单字符串的RDD转换成排 [英] RDD of List String convert to Row

查看:713
本文介绍了清单字符串的RDD转换成排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个字符串的固定大小的列表(解析CSV文件的结果)的RDD转换成和行RDD。这是这样我就可以把它变成一个数据帧,因为我需要它变成一个数据框写入到实木复合地板。反正我需要帮助的唯一部分是RDD从字符串排列表转换。

I'm trying to convert an RDD that has a fixed size lists of strings (a result of parsing CSV file) into and RDD of Rows. This is so I can turn it into a dataframe, because I need it into a dataframe to write to parquet. Anyway the only part I need help with is the converting of Rdd from list of strings to Row.

该RDD变量名是RDD

The RDD variable name is RDD

推荐答案

我用:

import org.apache.spark.sql._
val RowRDD = RDD.map(r => Row.fromSeq(r))

这篇关于清单字符串的RDD转换成排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆