Reputation: 25
students = load '/home/vm4learning/Desktop/students-db.txt' using PigStorage('|') as (rnum, sname, name, age, gender, class, subject, marks);
I am facing syntax error while using parameter substitution for /home/vm4learning/Desktop/students-db.txt. So what is the correct command with proper syntax to use here.
Thanks
Upvotes: 0
Views: 1483
Reputation: 2682
use pig -x filename dryrun -param key=value -param key2=value2
Upvotes: 1
Reputation: 6739
You need to specify the HDFS path to your Pig LOAD script
First you need to copy your input file in HDFS then you can specify the hdfs path in your pig script
You can use hadoop put command to copy your input file into HDFS using:
hadoop fs -put /home/vm4learning/Desktop/students-db.txt /user/input
then you can use that path in your pig script
students = load '/user/input/students-db.txt' using PigStorage('|') as (.....);
save your pig scripts in a file with extention .pig file.
process.pig:
students = load '$inputPath' using PigStorage('|') as (.....);
Now from terminal you can issue the following command to execute your pig file by passing your input path as argument:
pig -p inputPath=/user/input/students-db.txt process.pig
For more details you can check here
Upvotes: 1