When creating external table with location clause, you need to put
your csv into HDFS.
Or else you can load data local as Savant said.

On Fri, Sep 28, 2012 at 1:57 PM, Sarath
<sarathchandra.jos...@algofusiontech.com> wrote:
> 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.

Reply via email to