How can we ignore header line while loading data into Pig

0 votes

I have a text file which has header line + data lines.

Suppose we have a dataset like below,

"id","name","sal"
"1","jimmy","1000"
"2","hendrix","5000" 

How can we ignore header line while loading data into Pig?

Jul 10, 2019 in Big Data Hadoop by Ritu
2,924 views

1 answer to this question.

0 votes

Suppose you need to load this in an alias in pig but don't want the header. So, we can execute the below set of commands to remove the header.

A = load 'pigtest.txt' using PigStorage(',') as (id: chararray, name: chararray, sal: chararray);
ranked = rank A;
no_header = filter ranked by (rank_A > 1);
ordered = order no_header by rank_A;
new_A = foreach ordered generate id, name, sal;

Now, let's dump the new data,

dump new_A;
answered Jul 10, 2019 by Kiran

Related Questions In Big Data Hadoop

0 votes
1 answer

How can we send data from MongoDB to Hadoop?

The MongoDB Connector for Hadoop reads data ...READ MORE

answered Mar 27, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
2,120 views
+3 votes
1 answer

Getting Connection Error while loading data into table using cloudera hive

Hey Nafeesa, Itseems that Hive is not able ...READ MORE

answered Oct 4, 2018 in Big Data Hadoop by Vardhan
• 13,150 points
1,022 views
0 votes
1 answer

Hadoop Hive: How to skip the first line of csv while loading in hive table?

You can try this: CREATE TABLE temp ...READ MORE

answered Nov 8, 2018 in Big Data Hadoop by Omkar
• 69,220 points
8,998 views
0 votes
1 answer

Getting error while loading data into hive table

In the command you have used, the ...READ MORE

answered Jan 31, 2019 in Big Data Hadoop by Omkar
• 69,220 points
3,400 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,076 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,573 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,071 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,641 views
0 votes
1 answer

How can we ignore header line while loading data into Pig?

You can use the following code: A = ...READ MORE

answered Jul 22, 2019 in Big Data Hadoop by kiran
713 views
0 votes
1 answer

How to load data from HDFS into pig relation?

Hey, To load data from HDFS to pig ...READ MORE

answered May 7, 2019 in Big Data Hadoop by Gitika
• 65,770 points
3,270 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