RDD of List String convert to Row

岁酱吖の 提交于 2019-12-12 02:49:11

问题


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.

The RDD variable name is RDD


回答1:


I used:

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


来源:https://stackoverflow.com/questions/35441126/rdd-of-list-string-convert-to-row

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!