forked from tyakovenko/dataManagementProject2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskC.pig
More file actions
12 lines (9 loc) · 727 Bytes
/
TaskC.pig
File metadata and controls
12 lines (9 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
-- Load the pages.csv dataset
pages = LOAD 'Data/pages.csv' USING org.apache.pig.piggybank.storage.CSVExcelStorage(',', 'NO_MULTILINE', 'UNIX', 'SKIP_INPUT_HEADER') AS (PersonID: int, Name: chararray, Nationality: chararray, CountryCode: int, Hobby: chararray);
-- Group by Nationality and calculate the count of citizens
country_counts = GROUP pages BY Nationality;
country_facebook_count = FOREACH country_counts GENERATE group AS Nationality, COUNT(pages) AS CitizenCount;
-- Store the result
STORE country_facebook_count INTO 'Output/TaskC_Result' USING org.apache.pig.piggybank.storage.CSVExcelStorage(',', 'NO_MULTILINE', 'UNIX', 'WRITE_OUTPUT_HEADER');
-- Display the result
DUMP country_facebook_count;