com.holdenkarau.spark.testing - java.lang.NoSuchFieldError:METASTOREURIS

问题描述 投票:0回答:1

我有一个 Spark scala 应用程序,它使用以下版本。

依赖关系:

org.apache.spark:spark-core_2.12:jar:3.3.2
org.apache.spark:spark-hive_2.12:jar:3.3.2
org.apache.hive:hive-common:jar:2.3.9
com.holdenkarau:spark-testing-base_2.12:jar:3.3.2_2.0.1
org.apache.hive:hive-metastore:jar:4.0.0:provided

scala version - 2.12.18
Java version for compiling - 8
mvn version - 3.9.6

当我运行“mvn install”时,单元测试开始失败,并出现以下错误。

*** RUN ABORTED ***

An exception or error caused a run to abort: METASTOREURIS 
  java.lang.NoSuchFieldError: METASTOREURIS
  at com.holdenkarau.spark.testing.DataFrameSuiteBaseLike.builder(DataFrameSuiteBase.scala:177)
  at com.holdenkarau.spark.testing.DataFrameSuiteBaseLike.builder$(DataFrameSuiteBase.scala:160)
  at com.walmart.dsi.gg.BaseSpec.builder(BaseSpec.scala:14)
  at com.holdenkarau.spark.testing.DataFrameSuiteBaseLike.sqlBeforeAllTestCases(DataFrameSuiteBase.scala:219)
  at com.holdenkarau.spark.testing.DataFrameSuiteBaseLike.sqlBeforeAllTestCases$(DataFrameSuiteBase.scala:213)
  at com.walmart.dsi.gg.BaseSpec.com$holdenkarau$spark$testing$DataFrameSuiteBase$$super$sqlBeforeAllTestCases(BaseSpec.scala:14)
  at com.holdenkarau.spark.testing.DataFrameSuiteBase.beforeAll(DataFrameSuiteBase.scala:97)
  at com.holdenkarau.spark.testing.DataFrameSuiteBase.beforeAll$(DataFrameSuiteBase.scala:95)
  at com.walmart.dsi.gg.BaseSpec.beforeAll(BaseSpec.scala:22)
  at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:212)

我看到“HiveConf”类中不存在“METASTOREURIS”字段(https://github.com/apache/hive/blob/master/common/src/java/org/apache/hadoop/hive/conf/ HiveConf.java).

我应该在这里使用什么版本的 hive 或 Holdenkarau 库?

java scala apache-spark hive scalatest
1个回答
0
投票

字段 METASTOREURIS 存在于 Hive 3.x 及更高版本中,但不存在于 Hive 2.3.x 中

使用 org.apache.hive:hive-common:jar:3.1.2

如果由于其他限制而升级 Hive 不可行,则必须降级 Spark-testing-base 库以与 Hive 2.3.9 保持一致

© www.soinside.com 2019 - 2024. All rights reserved.