我正在尝试使用 JavaSparkContext 对象创建 SQL 上下文对象,因为它的参数如下:
SparkConf sparkConf=new SparkConf().setMaster("local").setAppName("Example");
JavaSparkContext sc=new JavaSparkContext(sparkConf);
SQLContext sqlctx=new HiveContext(sc);
Eclipse 抛出一个错误说:
The constructor HiveContext(JavaSparkContext) is undefined
但是我在互联网上查找的所有示例,包括文档都使用 JavaSparkContext 作为参数。我错过了什么吗?
Maven依赖:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.10</artifactId>
<version>1.2.0</version>
<scope>provided</scope>
</dependency>