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 in Big Data Hadoop by Tony
13 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 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 in Big Data Hadoop by John
64 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 in Big Data Hadoop by Esha
14 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
684 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,290 points
65 views
0 votes
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,490 points
2,340 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,490 points
238 views
0 votes
10 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
12,016 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,240 points
885 views
0 votes
1 answer
0 votes
1 answer