Pig script not dumping the data correctly

0 votes

Hi,
The following pig script is not dumping the columns correctly.
The 1st column is missing.

airportDetail = LOAD "/user/edureka_181724/hdpProject/airports_mod.dat" using PigStorage(",");
mappedAirportData = FOREACH airportDetail GENERATE (int)$1 AS airport_id,(chararray)$2 AS name,(chararray)$3 AS city,(chararray)$4 AS country,(chararray)$5 AS iata_code;
dump mappedAirportData
Jul 15, 2019 in Big Data Hadoop by Tony
35 views

1 answer to this question.

0 votes

The first column is denoted by $0, the second with $1 and so on. So, the correct set of commands will be as below,

airportDetail = LOAD '/user/edureka_181724/hdpProject/airports_mod.dat' using PigStorage(',');

mappedAirportData = FOREACH airportDetail GENERATE (int)$0 AS airport_id,(chararray)$1 AS name,(chararray)$2 AS city,(chararray)$3 AS country,(chararray)$4 AS iata_code;

dump mappedAirportData;
answered Jul 15, 2019 by George

Related Questions In Big Data Hadoop

0 votes
1 answer

Failing to execute the script pig file on HDFS

By convention, the pig script that you ...READ MORE

answered Feb 14, 2019 in Big Data Hadoop by John
98 views
0 votes
1 answer

Syntax to mention that the data is enclosed in double quotes in pig

So, we will execute the below command, new_A_2 ...READ MORE

answered Jul 10, 2019 in Big Data Hadoop by Esha
54 views
+1 vote
2 answers

Execute Pig Script from Grunt Shell

From your current directory run  pig -x local Then ...READ MORE

answered Oct 25, 2018 in Big Data Hadoop by Kunal
1,130 views
0 votes
1 answer

Why am I not able to see the Hadoop daemons that are running?

I guess you are starting the services ...READ MORE

answered Apr 18, 2018 in Big Data Hadoop by Shubham
• 13,370 points
92 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,840 points
3,913 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,840 points
538 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
20,811 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,290 points
1,476 views
0 votes
1 answer
0 votes
1 answer

How to check the directory is present in shell script or not?

Hi, To check the directory is present in ...READ MORE

answered Jun 24, 2019 in Big Data Hadoop by Gitika
• 25,460 points
38 views