I am very new to Hadoop. My hadoop version is 3.1.1 and pig version is 0.17.0.
Everything is working as expected by running this script in local mode
pig -x local
grunt> student = LOAD '/home/ubuntu/sharif_data/student.txt' USING PigStorage(',') as ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
grunt> DUMP student;
But for the same input file and pig script, mapreduce mode is not working successfully.
pig -x mapreduce
grunt> student = LOAD '/pig_data/student.txt' USING PigStorage(',') AS ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
grunt> STORE student INTO '/pig_data/student_out' USING PigStorage (',');
OR
grunt> student = LOAD 'hdfs://NND1:9000/pig_data/student.txt' USING PigStorage(',') AS ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
grunt> STORE student INTO 'hdfs://NND1:9000/pig_data/student_out' USING PigStorage (',');
Result for mapreduce mode OR Note: student.txt is uploaded to HDFS successfully.
hdfs dfs -ls /pig_data
Found 2 items
-rw-r--r-- 3 ubuntu supergroup 861585 2019-07-12 00:55 /pig_data/en.sahih.txt
-rw-r--r-- 3 ubuntu supergroup 234 2019-07-12 12:25 /pig_data/student.txt
Even under grunt this command returns correct HDFS file name.
grunt> fs -cat /pig_data/student.txt
Any help is appreciated.
Part of the problem is that Pig 0.17 doesn't support Hadoop 3 yet.
The Apache Pig Releases states for 0.17:
19 June, 2017: release 0.17.0 available
The highlights of this release is the introduction of Pig on Spark
Note: This release works with Hadoop 2.X (above 2.7.x)
And JIRA PIG-5253 - Pig Hadoop 3 support is still in progress.