我可以读取Json和printSchema
,但运行任何操作失败(没有在作业中指定输入路径)
val sc = new org.apache.spark.SparkContext("local[*]", "shell")
val sqlCtx = new SQLContext(sc)
val input = sqlCtx.jsonFile("../data/tweets/")
input.printSchema
根|——contributorsid: array (nullable = true)
| |——element: string (containsNull = true)
|——createdAt: string (nullable = true)
…
input.first
java.io.IOException: No input paths specified in job
文件夹结构如下:
- 微博
- tweets_1444576960000
- _SUCCESS
- 部分- 00000
- tweets_1444577070000
- _SUCCESS
- 部分- 00000
- tweets_1444576960000
指出:
- 我使用Spark和Spark SQL版本1.5.0
- 同一机器上的
local[*]
执行器 - 我尝试用绝对路径替换文件路径。同样的错误
- 使用databrick的示例应用程序获取Json tweets
好的,通过指定路径来解决问题,如
val input = sqlCtx.jsonFile("../data/tweets/tweets_*/*")