hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim Chew <kchew...@gmail.com>
Subject Re: Load CSV to hive
Date Thu, 04 Sep 2014 17:28:49 GMT
First, you need to give your csv file a header. For example,

col1,col2,col3,...etc.
70268503,"2012-09-28 15:00:59",0,",01","18,01",,1,"
2012-10-01 17:01:11",0,,

Then create the table with,

CREATE TABLE IF NOT EXISTS foo (
    col1     INT,
    col2     STRING,
    col3      INT
    .......
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE

Then load data into your table,

LOAD DATA INPATH '/user/me/myinput.csv' OVERWRITE INTO TABLE foo;

HTH

Kim

On Thu, Sep 4, 2014 at 9:43 AM, Ricardo Pompeu Ferreras <
ricardo.ferreras@gmail.com> wrote:

> Hi,
>
> How I create a table with this structure ?
>
> The separte are , comma,
> There are fields with "xx" date and "yyy" with value.
>
> 70268503,"2012-09-28 15:00:59",0,",01","18,01",,1,"2012-10-01 17:01:11",0,,
>
> help please
> --
> Ricardo
> SP, Brasil
>

Mime
View raw message