Pig Difference between inner bag and outer bag

0 votes
Can someone explain to me the difference between inner bag and outer bag with example? Thanks in advance
Jul 16, 2019 in Big Data Hadoop by Will
2,779 views

1 answer to this question.

0 votes

Outer Bag:

An outer bag is nothing but a relation. In the below example, A is a relation or bag of tuples. You can think of this bag as an outer bag.

A = LOAD 'data' as (f1:int, f2:int, f3:int); 
DUMP A; 

(1,2,3) 
(4,2,1) 
(8,3,4) 
(4,3,3)

Inner bag:

An inner bag is a relation inside any other bag.

Example:

Now, suppose we group relation A by the first field to form relation X.

In this example, X is a relation or bag of tuples. The tuples in relation X have two fields. The first field is type int. The second field is type bag; you can think of this bag as an inner bag.

X = GROUP A BY f1; 
DUMP X; 
(1,{(1,2,3)}) 
(4,{(4,2,1),(4,3,3)}) 
(8,{(8,3,4)})
answered Jul 16, 2019 by Firoz

Related Questions In Big Data Hadoop

0 votes
1 answer

What do you understand by an inner bag and outer bag in Pig?

Outer bag or relation is nothing but ...READ MORE

answered Feb 21, 2019 in Big Data Hadoop by Frankie
• 9,830 points
1,446 views
0 votes
1 answer

What is difference between pig and Mapreduce?

Hey, In MapReduce need to writ entire logic ...READ MORE

answered May 3, 2019 in Big Data Hadoop by Gitika
• 65,770 points
1,661 views
0 votes
1 answer

Difference between Pig and Hive? Why have both? [closed]

The hive was designed to appeal to ...READ MORE

answered Nov 20, 2020 in Big Data Hadoop by Gitika
• 65,770 points
591 views
0 votes
1 answer
+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,028 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,536 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
108,832 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,612 views
0 votes
10 answers

What is the difference between Mongodb and Hadoop?

MongoDB is a NoSQL database, whereas Hadoop is ...READ MORE

answered Jun 20, 2018 in Big Data Hadoop by jenny_code
12,099 views
+2 votes
10 answers

Is there any difference between “hdfs dfs” and “hadoop fs” shell commands?

hadoop fs <args> fs is used for generic ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by anonymous
34,037 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