hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Savant, Keshav" <Keshav.C.Sav...@fisglobal.com>
Subject RE: Problem loading a CSV file
Date Fri, 28 Sep 2012 06:08:05 GMT
Hi Sarath,

Considering your two step approach...

The load command by default searches for file in HDFS, so you are doing the same by following
command

hive> load data inpath '/user/hduser/dumps/table_dump.csv' overwrite into table table1;

instead, you can use 'local' to tell hive that the CSV file is on local file system and not
on HDFS, as below

hive> load data local inpath '/user/hduser/dumps/table_dump.csv' overwrite into table table1;

Hope that helps

Kind regards,
Keshav C Savant

From: Sarath [mailto:sarathchandra.josyam@algofusiontech.com]
Sent: Friday, September 28, 2012 11:28 AM
To: user@hive.apache.org
Subject: Problem loading a CSV file

Hi,

I have created a new table using reference to a file on HDFS -
create external table table1 (field1 STRING, field2 STRING, field3 STRING, field3 STRING,
field4 STRING, field5 FLOAT, field6 FLOAT, field7 FLOAT, field8 STRING, field9 STRING) row
format delimited fields terminated by ',' location '/user/hduser/dumps/table_dump.csv';

The table got created successfully. But when I try retrieving rows from this table, it returns
me nothing.
hive> select * from table1;
OK
Time taken: 0.156 seconds

I also tried creating the table first and then loading the HDFS file data into it -
hive> create table table1 (field1 STRING, field2 STRING, field3 STRING, field3 STRING,
field4 STRING, field5 FLOAT, field6 FLOAT, field7 FLOAT, field8 STRING, field9 STRING) row
format delimited fields terminated by ',';
OK
Time taken: 0.088 seconds

But when I try to load data into this table I'm getting below error -
hive> load data inpath '/user/hduser/dumps/table_dump.csv' overwrite into table table1;
FAILED: Error in semantic analysis: Line 1:17 Invalid path ''/user/hduser/dumps/table_dump.csv'':
No files matching path hdfs://master:54310/user/hduser/dumps/table_dump.csv

What is going wrong? Is there a different way to load a CSV file using hive?

Regards,
Sarath.

_____________
The information contained in this message is proprietary and/or confidential. If you are not
the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review
by persons other than the intended recipient. Thank you.

Mime
View raw message