【发布时间】:2015-10-27 01:51:06
【问题描述】:
我想将本地文件读入 Spark。我正在使用 Windows。使用以下命令:
input = sc.textFile("D://sample.txt")
我尝试了所有可能的组合,但不断收到以下或非常相似的错误。
我尝试了以下方法:
添加 file:/// 和 file://
添加文件:\\ 和文件:\
D:/sample.txt
D:\sample.txt
D:\sample.txt
当前工作目录为 D:\,文件存在于 D:\
谁有想法?
>>> input = sc.textFile("D://sample.txt")
15/10/27 02:37:37 INFO MemoryStore: ensureFreeSpace(157288) called with curMem=7
891904, maxMem=556038881
15/10/27 02:37:37 INFO MemoryStore: Block broadcast_46 stored as values in memor
y (estimated size 153.6 KB, free 522.6 MB)
15/10/27 02:37:37 INFO MemoryStore: ensureFreeSpace(14276) called with curMem=80
49192, maxMem=556038881
15/10/27 02:37:37 INFO MemoryStore: Block broadcast_46_piece0 stored as bytes in
memory (estimated size 13.9 KB, free 522.6 MB)
15/10/27 02:37:37 INFO BlockManagerInfo: Added broadcast_46_piece0 in memory on
localhost:52887 (size: 13.9 KB, free: 529.6 MB)
15/10/27 02:37:37 INFO SparkContext: Created broadcast 46 from textFile at null:
-1
另外,我们在使用 Windows 时是否总是在命令行中使用反斜杠?还是只是为了目录?
非常感谢, 考比
【问题讨论】:
-
你可以试试“sample.txt”吗?
-
好的,那么错误是什么?到目前为止,您显示的是一个普通的日志。
-
只是 sample.txt 不起作用。错误是,我为 textField() 的每个参数得到相同的日志
-
即使我尝试了 apache spark 教程中的“input = sc.textField("README.md")”
标签: python apache-spark bigdata data-science