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 in Big Data Hadoop by Will
16 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 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 in Big Data Hadoop by Frankie
• 9,810 points
89 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 in Big Data Hadoop by Gitika
• 25,300 points
65 views
0 votes
1 answer
0 votes
1 answer

What is difference between Oozie workflow, coordinator and bundle ?

Workflow does not have time specifications to ...READ MORE

answered Mar 28, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
548 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,306 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
237 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
11,895 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
880 views
0 votes
10 answers

What is the difference between Mongodb and Hadoop?

Apart from the similarity that they are ...READ MORE

answered Dec 6, 2018 in Big Data Hadoop by Deeraj
2,308 views
+2 votes
10 answers

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

Yes, there's a difference between hadoop fs and ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Kunal
9,254 views