hadoop - export data to csv using hive sql -
how export hive table/select query csv? have tried command below. creates output multiple files. better methods?
insert overwrite local directory '/mapr/mapr011/user/output/' row format delimited fields terminated ',' select fied1,field2,field3 table1
hive creates many files many reducers running. parallel. if want single file add order by
force running on single reducer or try increase bytes per reducer configuration parameter:
select fied1,field2,field3 table1 order fied1
or
set hive.exec.reducers.bytes.per.reducer=67108864; --increase accordingly
also can try merge files:
set hive.merge.smallfiles.avgsize=500000000; set hive.merge.size.per.task=500000000; set hive.merge.mapredfiles=true;
also can concatenate files using cat after getting them hadoop.
wiki
Comments
Post a Comment