2

Spark2 から Hive テーブルに格納されているデータをクエリしようとしています。環境: 1.cloudera-quickstart-vm-5.7.0-0-vmware 2. Scala2.11.8 プラグインを使用した Eclipse 3. Spark2 および Maven の下

Spark のデフォルト設定は変更しませんでした。Spark または Hive で何かを構成する必要がありますか?

コード

import org.apache.spark._
import org.apache.spark.sql.SparkSession
object hiveTest {
 def main (args: Array[String]){
   val sparkSession = SparkSession.builder.
      master("local")
      .appName("HiveSQL")
      .enableHiveSupport()
      .getOrCreate()

  val data=  sparkSession2.sql("select * from test.mark")
}
}

取得エラー

16/08/29 00:18:10 INFO SparkSqlParser: Parsing command: select * from test.mark
Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.apache.spark.sql.hive.HiveSharedState.metadataHive$lzycompute(HiveSharedState.scala:48)
    at org.apache.spark.sql.hive.HiveSharedState.metadataHive(HiveSharedState.scala:47)
    at org.apache.spark.sql.hive.HiveSharedState.externalCatalog$lzycompute(HiveSharedState.scala:54)
    at org.apache.spark.sql.hive.HiveSharedState.externalCatalog(HiveSharedState.scala:54)
    at org.apache.spark.sql.hive.HiveSessionState.catalog$lzycompute(HiveSessionState.scala:50)
    at org.apache.spark.sql.hive.HiveSessionState.catalog(HiveSessionState.scala:48)
    at org.apache.spark.sql.hive.HiveSessionState$$anon$1.<init>(HiveSessionState.scala:63)
    at org.apache.spark.sql.hive.HiveSessionState.analyzer$lzycompute(HiveSessionState.scala:63)
    at org.apache.spark.sql.hive.HiveSessionState.analyzer(HiveSessionState.scala:62)
    at org.apache.spark.sql.execution.QueryExecution.assertAnalyzed(QueryExecution.scala:49)
    at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:64)
    at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:582)
    at hiveTest$.main(hiveTest.scala:34)
    at hiveTest.main(hiveTest.scala)
Caused by: java.lang.IllegalArgumentException: requirement failed: Duplicate SQLConfigEntry. spark.sql.hive.convertCTAS has been registered
    at scala.Predef$.require(Predef.scala:224)
    at org.apache.spark.sql.internal.SQLConf$.org$apache$spark$sql$internal$SQLConf$$register(SQLConf.scala:44)
    at org.apache.spark.sql.internal.SQLConf$SQLConfigBuilder$$anonfun$apply$1.apply(SQLConf.scala:51)
    at org.apache.spark.sql.internal.SQLConf$SQLConfigBuilder$$anonfun$apply$1.apply(SQLConf.scala:51)
    at org.apache.spark.internal.config.TypedConfigBuilder$$anonfun$createWithDefault$1.apply(ConfigBuilder.scala:122)
    at org.apache.spark.internal.config.TypedConfigBuilder$$anonfun$createWithDefault$1.apply(ConfigBuilder.scala:122)
    at scala.Option.foreach(Option.scala:257)
    at org.apache.spark.internal.config.TypedConfigBuilder.createWithDefault(ConfigBuilder.scala:122)
    at org.apache.spark.sql.hive.HiveUtils$.<init>(HiveUtils.scala:103)
    at org.apache.spark.sql.hive.HiveUtils$.<clinit>(HiveUtils.scala)
    ... 14 more

どんな提案でも大歓迎です

ありがとう
ロビン

4

2 に答える 2