2016-07-26 83 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