Convert RDD of Array(Row) to RDD of Row?
问题 I have such data in a file and I'd like to do some statistics using Spark. File content: aaa|bbb|ccc ddd|eee|fff|ggg I need to assign each line an id. I read them as rdd and use zipWithIndex() . Then they should be like: (0, aaa|bbb|ccc) (1, ddd|eee|fff|ggg) I need to make each string associated with the id. I can get the RDD of Array(Row), but can't jump out of the array. How should I modify my code? import org.apache.spark.sql.{Row, SparkSession} val fileRDD = spark.sparkContext.textFile