hive insert directory指定分隔符

hive insert directory指定分隔符

1.hive0.11以前的版本

  hive0.11以前的版本不支持insert directory 后面指定分隔符,但可以通过concat方式来完成

  如:

  

insert overwrite directory 'hdfs://localhost:9000/app/test/' select concat(userid,"\t",mdt,"\t",case when loginfo['id'] is null then '' else loginfo['qid'] end,"\t" ,trim(urlpath),"\t",fr,"\t",loginfo['pro_errno'],"\t",province,"\t",city) from testapi where dt='20151025'

 

2.hive0.11支持指定分隔符

   

 insert overwrite local directory '/home/test/data/result'
  row format delimited
  fields terminated by '\t'
  select * from test;

 

你可能感兴趣的:(hive insert directory指定分隔符)