0% found this document useful (0 votes)
34 views

Pig Group and Co-Group

The document discusses using Pig Latin to perform data grouping and cogrouping. It shows how to create a group on the item_details relation by itemID. It then creates a multiple group on the group relation by itemID and qty. Finally, it uses cogroup to combine the order and order_details relations based on orderDate and itemID.

Uploaded by

PEPETI RAVI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Pig Group and Co-Group

The document discusses using Pig Latin to perform data grouping and cogrouping. It shows how to create a group on the item_details relation by itemID. It then creates a multiple group on the group relation by itemID and qty. Finally, it uses cogroup to combine the order and order_details relations based on orderDate and itemID.

Uploaded by

PEPETI RAVI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Create Group_Item on order_details relation by itemID

grunt> item_details = LOAD 'hdfs://localhost:9000/pig_data/item_details.txt' USING


PigStorage(',')
as (id:int, firstname:chararray, lastname:chararray, age:int, phone:chararray,
city:chararray);
grunt> Group_data = GROUP item_details BY item_id;

Verify the Group_Item by using Dump


grunt> Dump group_data;

Create multiple group as Group_Item_qty on order_details relation by iteamID and


qty
grunt> group = LOAD 'hdfs://localhost:9000/pig_data/group.txt' USING
PigStorage(',')
as (id:int, firstname:chararray, lastname:chararray, age:int, phone:chararray,
city:chararray);

grunt> group_item_qty = LOAD 'hdfs://localhost:9000/pig_data/group_item_qty.txt'


USING PigStorage(',')
as (id:int, name:chararray, age:int, city:chararray);
grunt> cogroup_data = COGROUP group by itemID, employee_details by qty;

Use cogroup on the two relations order and order_details created by orderDate and
ItemId
grunt> order = LOAD 'hdfs://localhost:9000/pig_data/order.txt' USING
PigStorage(',')
as (id:int, firstname:chararray, lastname:chararray, age:int, phone:chararray,
city:chararray);
grunt> order_details = LOAD 'hdfs://localhost:9000/pig_data/order_details.txt'
USING PigStorage(',')
as (id:int, name:chararray, age:int, city:chararray);
grunt> cogroup_data = COGROUP order by orderDate, order_details by itemid;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy