同一条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.

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐