当前位置:首页 > 数据库 > SQL其他

db2导出数据并导入hive临时表中

FIELDS TERMINATED BY:设置字段与字段之间的分隔符

COLLECTION ITEMS TERMINATED BY:设置一个复杂类型(array,struct)字段的各个item之间的分隔符

MAP KEYS TERMINATED BY:设置一个复杂类型(Map)字段的key value之间的分隔符

Hive> create table t(id struct<id1:int,id2:int,id3:int>,name array<string>,xx map<int,string>)
    > row format delimited
    > fields terminated by ‘t‘
    > collection items terminated by ‘,‘
    > map keys terminated by ‘:‘
    > lines terminated by ‘n‘;
OK
Time taken: 0.287 seconds

ROW FORMAT DELIMITED 必须在其它分隔设置之前,也就是分隔符设置语句的最前

LINES TERMINATED BY必须在其它分隔设置之后,也就是分隔符设置语句的最后,否则会报错

hive> create table t (id struct<id1:int,id2:int,id3:int>,name array<string>,xx map<int,string>) 
    > row format delimited
    > fields terminated by ‘t‘
    > lines terminated by ‘n‘
    > collection items terminated by ‘,‘
    > map keys terminated by ‘:‘;
FAILED: ParseException line 5:0 missing EOF at ‘collection‘ near ‘‘n‘‘

4、导入数据至hive中

load data local inpath ‘filename1.txt‘ into table tbl_cdhd_usr_id_xxt_tmp 

db2导出数据并导入hive临时表中

标签:cep   txt   导出   near   设置   string   local   导出数据   bsp   

本文系统来源:http://www.cnblogs.com/xitingxie/p/6758950.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐