apache-spark - 无法在 spark 中配置自定义 hive-metastore-client
问题描述
我们在使用 spark 和 hive 时面临一些挑战。我们需要从 spark 连接到 hive-metastore,并且我们必须在 spark 中使用自定义的 hive-metastore-client。代码片段:
spark = SparkSession \
.builder \
.config('spark.sql.hive.metastore.version','3.1.2' ) \
.config('spark.sql.hive.metastore.jars', 'hive-standalone-metastore-3.1.2-sqlquery.jar') \
.config("spark.yarn.dist.jars", "hive-exec-3.1.2.jar") \
.config('hive.metastore.uris', "thrift://localhost:9090") \
上面的代码适用于内置的 hive-metastore-client,但由于自定义错误而失败:
py4j.protocol.Py4JJavaError: 调用 o79.databaseExists 时出错。:java.lang.NoClassDefFoundError:org/apache/hadoop/hive/ql/metadata/HiveException
引起:java.lang.ClassNotFoundException:org.apache.hadoop.hive.ql.metadata.HiveException
为了解决这个问题,我们在代码中配置了自定义 hive-exec 并尝试使用命令行传递:
- /usr/local/Cellar/apache-spark/3.1.2/libexec/bin/spark-submit spark-session.py --jars hive-exec-3.1.2.jar
- /usr/local/Cellar/apache-spark/3.1.2/libexec/bin/spark-submit spark-session.py --conf spark.executor.extraClassPath hive-exec-3.1.2.jar
- /usr/local/Cellar/apache-spark/3.1.2/libexec/bin/spark-submit spark-session.py --driver-class-path hive-exec-3.1.2.jar
但是问题还没有解决,任何建议都会对我们有所帮助。
解决方案
推荐阅读
- data-visualization - QuickSight 跨多个视觉对象同步颜色
- python - 在 3d 数组中获取具有条件的特定轴的最大值
- image-processing - 如何为imagej中的特定操作添加快捷方式?
- python - 如何在 Python 上打开文件和应用程序
- r - Gcross theo-value 是否假设两个标记点模式都是随机分布的?
- arm - 直接从汇编语言访问性能计数器的 ARMv7 指令
- dynamic-programming - 目标总和 [leetcode] 通过分配符号计算具有给定目标总和的子集
- mongodb - 删除没有内容的记录
- javascript - Angular Typescript:Swagger CodeGen Generator 使所有类属性为 Nullable
- java - 使用 Java 查找区域的标准时间名称