天天看點

spark 3.1.x支援(相容)hive 1.2.x以及hadoop cdh版本的嘗試

版本

spark 3.1.x

hive 1.2.x

hadoop 2.6.0-cdh-5.13.1

背景

由于好多公司的yarn叢集用的是cdh版本的,用Cloudera Manager管理的。而截止到目前為止,spark的最新版本已經到了3.1.1。而對于cdh 2.6.0-5.13.1來說目前支援的hive版本為1.2.1,是以我們做一下集中嘗試:

  • 直接修改pom檔案中的hive對應的版本
  • 直接修改編譯的hadoop版本
  • 在spark運作的時候,動态加載hive對應的版本包

直接在spark的父pom檔案增加如下proflie資訊:

<profile>
    <id>hive-1.2</id>
    <properties>
      <hive.version>1.2.1</hive.version>
      <!-- Version used for internal directory structure -->
      <hive.version.short>1.2</hive.version.short>
      <hive.storage.version>2.6.0</hive.storage.version>
      <datanucleus-core.version>3.2.10</datanucleus-core.version>
    </properties>
  </profile>      

運作

./dev/make-distribution.sh --name 2.6.0-cdh5.13.1  --pip  --tgz  -Phive-1.2 -Phive-thriftserver -Pyarn      

報錯:

[INFO] --- scala-maven-plugin:4.3.0:compile (scala-compile-first) @ spark-hive_2.12 ---
[INFO] Using incremental compilation using Mixed compile order
[INFO] Compiler bridge file: .sbt/1.0/zinc/org.scala-sbt/org.scala-sbt-compiler-bridge_2.12-1.3.1-bin_2.12.10__52.0-1.3.1_20191012T045515.jar
[INFO] compiler plugin: BasicArtifact(com.github.ghik,silencer-plugin_2.12.10,1.6.0,null)
[INFO] Compiling 29 Scala sources and 2 Java sources to spark/sql/hive/target/scala-2.12/classes ...
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala:29: object SerializationUtilities is not a msmber of package org.apache.hadoop.hive.ql.exec
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala:150: not found: value SerializationUtilities
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala:154: not found: value SerializationUtilities
[ERROR] [Error] spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala:350: too many arguments (4) for constructor SimpleGenericUDAFParameterInfo: (x$1: Array[org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector], x$2: Boolean, x$3: Boolean)org.apache.hadoop.hive.ql.udf.generic.SimpleGenericUDAFParameterInfo
[ERROR] four errors found      

說明hive1.2.1版本的不相容

直接修改hadoop的版本為2.6.0-cdh5.13.1

運作如下指令:

./dev/make-distribution.sh --name 2.6.0-cdh5.13.1  --pip  --tgz  -Phive-1.2 -Phive-thriftserver -Pyarn -Dhadoop.version=2.6.0-cdh5.13.1      
[INFO] --- scala-maven-plugin:4.3.0:compile (scala-compile-first) @ spark-core_2.12 ---
[INFO] Using incremental compilation using Mixed compile order
[INFO] Compiler bridge file: .sbt/1.0/zinc/org.scala-sbt/org.scala-sbt-compiler-bridge_2.12-1.3.1-bin_2.12.10__52.0-1.3.1_20191012T045515.jar
[INFO] compiler plugin: BasicArtifact(com.github.ghik,silencer-plugin_2.12.10,1.6.0,null)
[INFO] Compiling 560 Scala sources and 99 Java sources to spark/core/target/scala-2.12/classes ...
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/HttpSecurityFilter.scala:107: type mismatch;
 found   : K where type K
 required: String
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/HttpSecurityFilter.scala:107: value map is not a member of V
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/HttpSecurityFilter.scala:107: missing argument list for method stripXSS in class XssSafeRequest
Unapplied methods are only converted to functions when a function type is expected.
You can make this conversion explicit by writing `stripXSS _` or `stripXSS(_)` instead of `stripXSS`.
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/ui/PagedTable.scala:307: value startsWith is not a member of K
[ERROR] [Error] spark/core/src/main/scala/org/apache/spark/util/Utils.scala:580: value toLowerCase is not a member of object org.apache.hadoop.util.StringUtils
[ERROR] 5 errors found      

繼續閱讀