Hive在load data時注意事項
- 2020 年 4 月 2 日
- 筆記
長話短說,來一個example實例:建表語句如下:
create table if not exists bdp_log( tableName string , dataTime string , startTime string , endTime string , groupName string , dcn1 int, dcn2 int, dcn3 int, dcn4 int, dcnCount int, hiveCount int, executeStatus string) row format delimited fields terminated by '|' stored as textfile;
我們在使用load data local inpath時,導入數據如下:
t6_bal_fund | 20150812 | 2015/08/12 10:08:54 | 2015/08/12 10:11:09 | fund |82|43|NULL|NULL|125|125|0
必須注意:int類型字段內容與前後的分隔符之間必須無空格,否則導入數據中,對應int類型字段內容為NULL。如果將類型改為double,int類型數據後會默認加上.0。