Spark: how to use SparkContext.textFile for local file system

herman

I'm just getting started using Apache Spark (in Scala, but the language is irrelevant). I'm using standalone mode and I'll want to process a text file from a local file system (so nothing distributed like HDFS).

According to the documentation of the textFile method from SparkContext, it will

Read a text file from HDFS, a local file system (available on all nodes), or any Hadoop-supported file system URI, and return it as an RDD of Strings.

What is unclear for me is if the whole text file can just be copied to all the nodes, or if the input data should already be partitioned, e.g. if using 4 nodes and a csv file with 1000 lines, have 250 lines on each node.

I suspect each node should have the whole file but I'm not sure.

David Gruzman

Each node should contain a whole file. In this case local file system will be logically indistinguishable from the HDFS, in respect to this file.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Spark:如何将SparkContext.textFile用于本地文件系统

来自分类Dev

在Spark中,参数“ minPartitions”在SparkContext.textFile(path,minPartitions)中有什么作用?

来自分类Dev

SparkContext.textFile如何在幕后工作?

来自分类Dev

'SparkContext'对象没有属性'textfile'

来自分类Dev

Spark流丢失SparkContext

来自分类Dev

为什么SparkContext.textFile的partition参数不生效?

来自分类Dev

SparkContext.addFile与spark-submit --files

来自分类Dev

从Spark中的textFile读取和转换数据

来自分类Dev

与 textFile() 相比,Spark binaryRecords() 的性能较低

来自分类Dev

SparkContext.textFile 可以与自定义接收器一起使用吗?

来自分类Dev

错误 SparkContext:初始化 SparkContext 时出错 - Java + Eclipse + Spark

来自分类Dev

在Spark 2.0中是否已解除了单个SparkContext的限制?

来自分类Dev

何时使用SPARK_CLASSPATH或SparkContext.addJar

来自分类Dev

何时使用SPARK_CLASSPATH或SparkContext.addJar

来自分类Dev

Spark:任务不可序列化(广播/ RDD / SparkContext)

来自分类Dev

Apache Spark-JavaSparkContext无法转换为SparkContext错误

来自分类Dev

在Spark 2.0中是否已解除了单个SparkContext的限制?

来自分类Dev

如何使用spark sc.textFile获取文件名?

来自分类Dev

What file system does Android use?

来自分类Dev

How to delete a file from local disk in UWP

来自分类Dev

How to send a local file through a REST service?

来自分类Dev

引起原因:java.io.NotSerializableException:org.apache.spark.SparkContext-在Spark中使用JdbcRDD时

来自分类Dev

How to use dual monitors on a system with 2 computers?

来自分类Dev

How to change file system encoding via python?

来自分类常见问题

SparkContext.setCheckpointDir(hdfsPath)可以在不同的Spark应用程序中设置相同的hdfsPath吗?

来自分类Dev

spark-SparkContext和SqlContext-生命周期和threadafty

来自分类Dev

使用远程SparkContext在纱线上运行spark作业:Yarn应用程序已结束

来自分类Dev

从发送到spark-submit的__main__文件外部修改SparkContext

来自分类Dev

SparkContext错误-找不到文件/ tmp / spark-events不存在

Related 相关文章

  1. 1

    Spark:如何将SparkContext.textFile用于本地文件系统

  2. 2

    在Spark中,参数“ minPartitions”在SparkContext.textFile(path,minPartitions)中有什么作用?

  3. 3

    SparkContext.textFile如何在幕后工作?

  4. 4

    'SparkContext'对象没有属性'textfile'

  5. 5

    Spark流丢失SparkContext

  6. 6

    为什么SparkContext.textFile的partition参数不生效?

  7. 7

    SparkContext.addFile与spark-submit --files

  8. 8

    从Spark中的textFile读取和转换数据

  9. 9

    与 textFile() 相比,Spark binaryRecords() 的性能较低

  10. 10

    SparkContext.textFile 可以与自定义接收器一起使用吗?

  11. 11

    错误 SparkContext:初始化 SparkContext 时出错 - Java + Eclipse + Spark

  12. 12

    在Spark 2.0中是否已解除了单个SparkContext的限制?

  13. 13

    何时使用SPARK_CLASSPATH或SparkContext.addJar

  14. 14

    何时使用SPARK_CLASSPATH或SparkContext.addJar

  15. 15

    Spark:任务不可序列化(广播/ RDD / SparkContext)

  16. 16

    Apache Spark-JavaSparkContext无法转换为SparkContext错误

  17. 17

    在Spark 2.0中是否已解除了单个SparkContext的限制?

  18. 18

    如何使用spark sc.textFile获取文件名?

  19. 19

    What file system does Android use?

  20. 20

    How to delete a file from local disk in UWP

  21. 21

    How to send a local file through a REST service?

  22. 22

    引起原因:java.io.NotSerializableException:org.apache.spark.SparkContext-在Spark中使用JdbcRDD时

  23. 23

    How to use dual monitors on a system with 2 computers?

  24. 24

    How to change file system encoding via python?

  25. 25

    SparkContext.setCheckpointDir(hdfsPath)可以在不同的Spark应用程序中设置相同的hdfsPath吗?

  26. 26

    spark-SparkContext和SqlContext-生命周期和threadafty

  27. 27

    使用远程SparkContext在纱线上运行spark作业:Yarn应用程序已结束

  28. 28

    从发送到spark-submit的__main__文件外部修改SparkContext

  29. 29

    SparkContext错误-找不到文件/ tmp / spark-events不存在

热门标签

归档