hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MiaoMiao <liy...@gmail.com>
Subject Re: how to export to a csv file?
Date Sun, 23 Sep 2012 05:47:30 GMT
I would use this:
hive -S -e "SELECT some_field FROM some_table"|sed "s/,/_/"|sed
"s/\t/,/">some.csv

On Sun, Sep 23, 2012 at 11:14 AM, zuohua zhang <zuohua@gmail.com> wrote:
> I tried the following:
>
> CREATE TABLE test
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
> STORED AS TEXTFILE
> AS
> select
> *
> from
> test_new;
>
> set hive.io.output.fileformat=CSVTextFile;
> INSERT OVERWRITE DIRECTORY '/test'
> select * from test;
>
>
> hadoop dfs -getmerge /test /mnt/test
>
> when I check my /mnt/test, it shows with \A as delimiter not ,
>
> How to fix?
>
> Most importantly, some of the fields has , in them, so the proper csv format
> would be "day1, day2", how to achieve that?
>
> Thanks!

Mime
View raw message