2016-07-26 44 views
0

我有下面的代码,它应该告诉星火使用默认的数据库架构:使用默认SqlContext

sqlContext.sql(s"use default") 

当我运行这段代码,我得到上面的线以下错误:

[1.1] failure: ``with'' expected but identifier use found 

use default 
^ 
java.lang.RuntimeException: [1.1] failure: ``with'' expected but identifier use found 

use default 
^ 

这是什么意思? 为什么期待with

回答

0

数据库命令是有意义的,只是为o.a.s.sql.hive.HiveContex(火花< 2.0.0)或o.a.s.sql.SparkSession与蜂巢支持(火花2.0.0+)初始化,但它就像你使用标准o.a.s.sql.SQLContext不支持数据库看起来。

换句话说:

  • 与蜂巢支持内置使用星火二进制文件。
  • 初始化SQLContextHiveContext