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

0 votes

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 22 in Big Data Hadoop by Varsha
19 views

1 answer to this question.

0 votes

You can use the following code:

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 22 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,730 points
161 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
• 12,730 points
85 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
• 67,660 points
1,158 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 in Big Data Hadoop by Omkar
• 67,660 points
263 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,730 points
3,367 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,730 points
405 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
16,704 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,260 points
1,220 views
0 votes
1 answer

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

Suppose you need to load this in ...READ MORE

answered Jul 10 in Big Data Hadoop by Kiran
113 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 in Big Data Hadoop by Gitika
• 25,360 points
93 views