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
1,205 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 15, 2019 in Big Data Hadoop by John
880 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
1,322 views
0 votes
1 answer

Execute the Pig script in Local mode.

Hi@akhtar, You can write an entire Pig Latin ...READ MORE

answered Oct 14, 2020 in Big Data Hadoop by MD
• 95,460 points
561 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
6,268 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
• 11,380 points
11,078 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
• 11,380 points
2,575 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,076 views
–1 vote
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,350 points
4,643 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 25, 2019 in Big Data Hadoop by Gitika
• 65,770 points
687 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP