背景
前段时间我在海豚上打包程序写hive出现了一个问题,spark程序向hive写数据时,报了如下bug,
org.apache.spark.sql.AnalysisException:
The format of the existing table test.xx is 'HiveFileFormat'
It doesn't match the specified format 'ParquetFIleFormat'
原因分析:
一开始我以为是我再hue上创建hive建的表,建表格式大致如下
create table if not exists test.xx (
id int,
name string
)
stored as PARQUET
/**
*created by: Matrix70
*blog: https://blog.youkuaiyun.com/qq_52128187?type=blog
*/
后来我删了建,把分区也删了,parquet格式也加了,还是报这个问题,因此排除是建表问题
后来我看代码,入库的语句如下,死活写不进去
println("===========开始入库========")
userFrame.write.mode.("overwrite").saveAsTable("test.xx")
后来我换了 一种写法,写进去了。