如果在本地windows測試的時候,不能加.enableHiveSupport():
val spark = SparkSession.builder()
.master("")
.appName("")
.getOrCreate()
訪問的是本地的表,不能訪問Hive表。
如果想訪問Hive表要加上.enableHiveSupport():
val spark = SparkSession.builder()
.master("")
.appName("")
.enableHiveSupport()
.getOrCreate()
在Windows使用 .enableHiveSupport()會出現一個異常:
Unable to instantiate SparkSession with Hive support because Hive classes are not found.
只能把代碼打包到linux上去執行,在windows上訪問hive就是不可以。