Skip to content

Instantly share code, notes, and snippets.

@svngoku
Last active February 16, 2022 11:16
Show Gist options
  • Save svngoku/5cac57d815b254dd47384e808ac20c9c to your computer and use it in GitHub Desktop.
Save svngoku/5cac57d815b254dd47384e808ac20c9c to your computer and use it in GitHub Desktop.
-- LOAD THE COUNTRIES DATASETS
counteries_datasets = LOAD '/user/hadoop_project/datasets/counteries/african_countries.csv' USING PigStorage(',');
-- CREATE COLS FOR COUNTRIES DATASETS
countries_details = FOREACH countries_details GENERATE $0 AS id, $1 AS country, $2 AS population, $3 sous_region;
--
NameSal = LOAD '/home/asingh50/NameSalary.txt' USING PigStorage(',') AS (name:chararray,salary:chararray);
NameSalGroup = GROUP NameSal by (name);
NameSalResult = FOREACH NameSalGroup GENERATE group AS Name, BagToString(NameSal.salary, ',') as salary:chararray;
-- CREATE THE DATE
DateTable = LOAD 'hdfs://localhost:9000/pig_data/dateofbirth.txt' USING PigStorage(',')
AS (id: int, year:int);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment