解決方案寫在前面:alter table xxxx set fileformat parquet
因爲同事升級Spark時出的bug,誤以爲需要修改 Hive Metastore 的記錄。然後歷程比較坎坷,所以記錄一下
Spark 1.6.2 創建分區表時,在 Hive Metastore 裏記錄的是
# Storage Information
InputFormat: org.apache.hadoop.mapred.SequenceFileInputFormat
OutputFormat: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
需要修改爲 parquet 格式。找了老多blog,很多隻記錄瞭如何修改SerDe Library,沒有說怎麼修改InputFormat,最後從 Hive 的 jira(HIVE-6756) 裏獲得啓發。應該修改 table 的 fileformat。再結合 拋磚引玉的blog 。每個分區都應該修改 fileformat。
最後是兩種方案:一種是用 2.2 把分區表全表重建一遍。還有一種是每個分區都去修改 fileformat。
路漫漫其修遠兮,加油加油!