I tried to load the file through PIG and getting error as below.


4 Answer(s)


Use below commands.
make a directory in your HDFS.

hadoop fs -mkdir pig;

Please move your input file into HDFS.

"user/cloudera/pig"

try to load the same.

grunt> nydailyprices = LOAD '/user/cloudera/pig/NASDAQ_daily_prices_A.csv' using PigStorage(',') AS (exchange:chararray,stock_symbol:chararray,date:chararray,stock_price_open:float,stock_price_high:float,stock_price_low:float,stock_price_close:float,stock_volume:float,stock_price_adj_close:float);

display loaded data.

grunt> dump nydailyprices;

Hi Keerthi,

If you look at the error message, it states that input path don't exists : "ERROR 2118: Input path does not exist: hdfs://localhost/home/cloudera/keerthi/pig_sample_data/nasdaq-sample/NASDAQ/NASDAQ_daily_prices_A.csv"

Looks like you have file in local file-system at this path and NOT in hdfs.
To resolve this error, execute following set of commands:
1. hadoop dfs -copyFromLocal /home/cloudera/keerthi/pig_sample_data/nasdaq-sample/NASDAQ/NASDAQ_daily_prices_A.csv /tmp/NASDAQ_daily_prices_A.csv
2. grunt> nydailyprices = LOAD '/tmp/NASDAQ_daily_prices_A.csv' using PigStorage(',') AS (exchange:chararray,stock_symbol:chararray,date:chararray,stock_price_open:float,stock_price_high:float,stock_price_low:float,stock_price_close:float,stock_volume:float,stock_price_adj_close:float);
3. grunt> dump nydailyprices ;

This should work.
Please post, if need further helps.



I am facing an error in DUMP command..I got the same error even though I followed your instructions of copying the local file into hadoop directories :(

Facing same issue:

[cloudera@quickstart ~]$ hdfs dfs -mkdir /user/cloudera/pigin
[cloudera@quickstart ~]$ hdfs dfs -put /home/cloudera/testfile /user/cloudera/pigin/testfile

--starting pig shell

grunt>
grunt> wordfile = LOAD '/user/cloudera/pigin/testfile' USING PigStorage('\n') as (linesin:chararray);
grunt> describe wordfile
wordfile: {linesin: chararray}

grunt> tempfile = LIMIT wordfile 10;
grunt> DUMP tempfile

Input(s):
Failed to read data from "/user/cloudera/pigin/testfile"

Output(s):

Job DAG:
job_local1468722327_0001 -> null,
null