4.5.5 数据导出到hdfs
1. 以TXT文件格式导出到hdfs
语法如下:
export text into {datafile} select CL_CONCAT_WS('#',col1,col2,col3) from (select columnA, columnB from Table_name where partition = ' partition_name ' and colname='N') tmp;
示例如下:
export text into /data/export/common_example001_txt select CL_CONCAT_WS('#',s1,s2,i1) from (select s1,s2,i1 from common_example001 where partition like 'teststream' ) tmp;
2. 以JSON文件格式导出到hdfs,覆盖目录下的所有文件
语法如下:
export json overwrite datafile select column1, columnB from Table_name where partition = ' partition_name ' and columnB ='N';
示例如下:
export json overwrite /data/export/common_example001_json select s1,s2,i1 from common_example001 where partition like 'teststream';