README.md
文件,但是失败了。我的操作如下:$ sudo docker run -i -t -h sandbox sequenceiq/spark:1.1.0 /etc/bootstrap.sh -bash
bash-4.1# cd /usr/local/spark-1.1.0-bin-hadoop2.4
bash-4.1# ls README.md
README.md
bash-4.1# ./bin/spark-shell
scala> val f = sc.textFile("README.md")
14/12/04 12:11:14 INFO storage.MemoryStore: ensureFreeSpace(164073) called with curMem=0, maxMem=278302556
14/12/04 12:11:14 INFO storage.MemoryStore: Block broadcast_0 stored as values in memory (estimated size 160.2 KB, free 265.3 MB)
f: org.apache.spark.rdd.RDD[String] = README.md MappedRDD[1] at textFile at <console>:12
scala> val wc = f.flatMap(l => l.split(" ")).map(word => (word, 1)).reduceByKey(_ + _)
org.apache.hadoop.mapred.InvalidInputException: Input path does not exist: hdfs://sandbox:9000/user/root/README.md
at org.apache.hadoop.mapred.FileInputFormat.singleThreadedListStatus(FileInputFormat.java:285)
我该如何加载那个
README.md
文件?
"file:///C:\\Xiang\\inputfile"
和"file:////C:\\Xiang\\inputfile"
都可以工作,而"file://C:\\Xiang\\inputfile"
在Java代码中无法工作。在Linux上呢?前缀应该是file:///
(三个斜杠)还是file:////
(四个斜杠)?file:////
在Linux上也可以工作吗? - XYZstatic final URI NAME = URI.create("file:///");
,因此我认为应该将其硬编码为带有三个斜杠的前缀file:///
。但我仍然不明白为什么file:////
(四个斜杠)也可以工作。 - XYZ