Question: Write an Apache Pig query that implements: 1) The Age attribute is divided into six groups, which are [10, 20), [20, 30), [30, 40), [40,
Write an Apache Pig query that implements:
1) The Age attribute is divided into six groups, which are [10, 20), [20, 30), [30, 40), [40, 50), [50, 60), and [60, 70]. The bracket [ means the lower bound of a range is included, where as ) means the upper bound of a range is excluded.
2) Within each of the above age ranges, further division is performed based on the Gender, i.e., each of the 6 age groups is further divided into two groups.
3) For each group, we need to report the following info: Age Range, Gender, MinTransTotal, MaxTransTotal, AvgTransTotal
customers = LOAD '/piginput/customers.txt' USING PigStorage(',') AS (id:int,name:chararray,age:int,gender:chararray,CountryCode:int,salary:float);
transactions = LOAD '/piginput/transaction.txt' USING PigStorage(',') as (trans_id:int, id:int, age:int, total:float, num_items:int, description:chararray);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
