Apache Spark's RDD splitting according to the particular size

后端 未结 2 573
眼角桃花
眼角桃花 2020-12-21 05:43

I am trying to read strings from a text file, but I want to limit each line according to a particular size. For example;

Here is my representing the file.

2条回答
  •  感情败类
    2020-12-21 06:08

    You will need to read all the data anyhow. Not much you can do apart from mapping each line and trim it.

    rdd.map(line => line.take(3)).collect()
    

提交回复
热议问题