我是靠谱客的博主 过时冬天,这篇文章主要介绍spark-sql 与hive结果不一致,现在分享给大家,希望可以做个参考。

同一条sql,hive能生成表,而spark却生成的一张空表,或者数据缺少,存在null值,与hive结果不一致
设置

spark.sql.hive.convertMetastoreOrc=false
convertMetastoreParquet=false

即可
原因:
spark用自己的格式读取hive文件后进行自动转换后进行操作

官方说明

spark.sql.hive.convertMetastoreParquet : When reading from and writing
to Hive metastore Parquet tables, Spark SQL will try to use its own
Parquet support instead of Hive SerDe for better performance. This
behavior is controlled by the spark.sql.hive.convertMetastoreParquet
configuration, and is turned on by default.

spark.sql.hive.convertMetastoreOrc: enables new ORC format to
read/write Hive Tables.

最后

以上就是过时冬天最近收集整理的关于spark-sql 与hive结果不一致的全部内容,更多相关spark-sql内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(130)

评论列表共有 0 条评论

立即
投稿
返回
顶部