赞
踩
问题描述:在IDEA中Spark整合hive报异常
Unable to instantiate SparkSession with Hive support because Hive classes are not found
val spark = SparkSession.builder().appName("SparkSQLOps").master("local[*]")
.enableHiveSupport()
.getOrCreate
spark.sql("show tables").show()
如果在本地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上去执行, 或者去除.enableHiveSupport(),在IDEA中读取
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。