当我在镶木地板文件上运行SQL时,我总是调用sqlContext.read.parquet()
=> df.registerTempTable()
=> sqlContext.sql()
喜欢这样:
val df = sqlContext.read.parquet("path/to/2016.05.30/")
df.registerTempTable("tab")
sqlContext.sql("SELECT * FROM tab")
Instead of using read API to load a file into DataFrame and query it, you can also query that file directly with SQL.
val df = sqlContext.sql("SELECT * FROM parquet.`examples/src/main/resources/users.parquet`")
所以我改变了这样:
val df = sqlContext.sql("SELECT * FROM parquet.`path/to/2016.05.30/`")
但我收到错误
org.apache.spark.sql.AnalysisException: no such table parquet.path/to/2016.05.30/;
我如何直接查询?
答案 0 :(得分:0)
直接查询文件将从Spark 1.6开始支持。请检查您正在运行的火花版本。