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
425 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 26, 2018 in Big Data Hadoop by nitinrawat895
• 10,920 points
501 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 3, 2018 in Big Data Hadoop by Vardhan
• 13,200 points
156 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,040 points
3,161 views
0 votes
1 answer

Getting error while loading data into hive table

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

answered Jan 30, 2019 in Big Data Hadoop by Omkar
• 69,040 points
684 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,920 points
5,444 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,920 points
802 views
+1 vote
11 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
33,693 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,310 points
2,054 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
43 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
• 32,970 points
462 views