Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REGISTER /usr/hdp/current/pig-client/piggybank.jar;
- lifes = LOAD 'labs/hadoop/pig/Life_Expectancy_Data.csv' USING org.apache.pig.piggybank.storage.CSVExcelStorage() as (
- country:chararray,
- year:int,
- status:chararray,
- life_expectancy:double,
- adult_mortality:int,
- infant_deaths:int,
- alcohol:double,
- percentage_expenditure:double,
- hepatitis_b:int,
- measles:int,
- BMI:double,
- under_five_deaths:int,
- polio:int,
- total_expenditure:double,
- diphtheria:int,
- HIV_AIDS:double,
- GDP:double,
- Population:int,
- thinness_1_19_years:double,
- thinness_5_9_years:double,
- income_composition_of_resources:double,
- schooling:double);
- grouped = GROUP lifes BY country;
- resultsAvg = FOREACH grouped GENERATE lifes.country, AVG(lifes.Population) as averagePop, AVG(lifes.life_expectancy) as averageLife ;
- results = ORDER resultsAvg BY averagePop DESC;
- results = LIMIT results 3;
- DUMP results;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement