以Python为例子:
spark = SparkSession.builder.config("hive.metastore.uris","thrift://10.1.1.18:9083").appName("tSalesItem").enableHiveSupport().getOrCreate()
spark.sql("show databases").show()
异常处理:
#查看hive运行日志发现多版本出现的时候,有如下日志
Version information not found in metastore. hive.metastore.schema.verification is not enabled so recording the schema version
#意思是说在metastore中未找到版本信息,hive.metastore.schema.verification未禁用,因此记录下版本信息,也就是往版本表中插入一条记录
解决方法:
修改版本校验为false:修改配置文件持久生效。
<property>
<name>hive.metastore.schema.verification.record.version</name>
<value>false</value>
</property>
本文介绍在使用Python操作Spark时遇到的Hive多版本问题及解决方案。通过修改配置文件中的hive.metastore.schema.verification.record.version属性为false,可以避免因版本信息缺失导致的异常,确保Spark与Hive的稳定连接。
1万+

被折叠的 条评论
为什么被折叠?



