spark 3.1.x支持(兼容)hive 1.2.x以及hadoop cdh版本的尝试

简介: 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对应的版本包


直接修改pom文件中的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版本


直接修改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

说明对2.6.0-cdh5.13.1版本的不兼容


在spark运行的时候,动态加载hive对应的版本包


根据官网的说明 ,spark从1.4.0 开始就能和不同的hive元数据进行交互,也就是说spark编译的hive内部版本和spark访问hive的元数据是独立的,可以配置不同的hive版本进行对应元数据的访问。具体的配置可以参考以上官网配置。


相关文章
|
4月前
|
分布式计算 Hadoop Android开发
hadoop-eclipse-plugin(版本hadoop2.7.3)
hadoop-eclipse-plugin(版本hadoop2.7.3)
68 6
hadoop-eclipse-plugin(版本hadoop2.7.3)
|
3月前
|
SQL 分布式计算 关系型数据库
Hadoop-12-Hive 基本介绍 下载安装配置 MariaDB安装 3台云服务Hadoop集群 架构图 对比SQL HQL
Hadoop-12-Hive 基本介绍 下载安装配置 MariaDB安装 3台云服务Hadoop集群 架构图 对比SQL HQL
47 2
|
4月前
|
存储 分布式计算 Hadoop
Hadoop 3.x版本的新特性
【6月更文挑战第18天】
112 2
|
3月前
|
分布式计算 DataWorks 调度
MaxCompute产品使用合集之如何将数据迁移到CDH Hive
MaxCompute作为一款全面的大数据处理平台,广泛应用于各类大数据分析、数据挖掘、BI及机器学习场景。掌握其核心功能、熟练操作流程、遵循最佳实践,可以帮助用户高效、安全地管理和利用海量数据。以下是一个关于MaxCompute产品使用的合集,涵盖了其核心功能、应用场景、操作流程以及最佳实践等内容。
|
4月前
|
SQL 分布式计算 HIVE
实时计算 Flink版产品使用问题之同步到Hudi的数据是否可以被Hive或Spark直接读取
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStream API、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
|
4月前
|
SQL 分布式计算 NoSQL
使用Spark高效将数据从Hive写入Redis (功能最全)
使用Spark高效将数据从Hive写入Redis (功能最全)
246 1
|
5月前
|
SQL 分布式计算 关系型数据库
使用 Spark 抽取 MySQL 数据到 Hive 时某列字段值出现异常(字段错位)
在 MySQL 的 `order_info` 表中,包含 `order_id` 等5个字段,主要存储订单信息。执行按 `create_time` 降序的查询,显示了部分结果。在 Hive 中复制此表结构时,所有字段除 `order_id` 外设为 `string` 类型,并添加了 `etl_date` 分区字段。然而,由于使用逗号作为字段分隔符,当 `address` 字段含逗号时,数据写入 Hive 出现错位,导致 `create_time` 值变为中文字符串。问题解决方法包括更换字段分隔符或使用 Hive 默认分隔符 `\u0001`。此案例提醒在建表时需谨慎选择字段分隔符。
|
5月前
|
SQL 分布式计算 Java
Spark 为什么比 Hive 快
Spark与Hive在数据处理上有显著区别。Spark以其内存计算和线程级并行提供更快的速度,但稳定性受内存限制。相比之下,Hive虽较慢,因使用MapReduce,其稳定性更高,对内存需求较小。在Shuffle方式上,Spark的内存 Shuffle 比Hive的磁盘 Shuffle 更高效。综上,Spark在处理速度和Shuffle上占优,Hive则在稳定性和资源管理上更胜一筹。
|
3天前
|
存储 分布式计算 资源调度
两万字长文向你解密大数据组件 Hadoop
两万字长文向你解密大数据组件 Hadoop
25 11
|
2月前
|
存储 分布式计算 Hadoop
下一篇
无影云桌面