Skip to content

Instantly share code, notes, and snippets.

@alienrobotwizard
Created March 1, 2013 18:17
Show Gist options
  • Save alienrobotwizard/5066613 to your computer and use it in GitHub Desktop.
Save alienrobotwizard/5066613 to your computer and use it in GitHub Desktop.
raw_student_activity = load '$INSTITUTION_PATH/student_activity/*' using civitas.analytics.pig_udf.PigStorageAvroSchema('$STUDENT_ACTIVITY_SCHEMA');
raw_instructor_activity = load '$INSTITUTION_PATH/instructor_activity/*' using civitas.analytics.pig_udf.PigStorageAvroSchema('$INSTRUCTOR_ACTIVITY_SCHEMA');
student_count_mappings = load '/tmp/umuc/student_activity_count_mappings.csv' using PigStorage(',') as (cnt_name:chararray, activity_type:chararray, activity_name:chararray);
instr_count_mappings = load '/tmp/umuc/instructor_activity_count_mappings.csv' using PigStorage(',') as (cnt_name:chararray, activity_type:chararray, activity_name:chararray);
student_event_log = foreach (join raw_student_activity by activity_name left outer, student_count_mappings by activity_type) generate
student_id, section_id, term_id, activity_pk, timestamp,
(student_count_mappings::activity_name is null ? raw_student_activity::activity_type : student_count_mappings::activity_name),
(student_count_mappings::activity_type is null ? raw_student_activity::activity_name : student_count_mappings::activity_type),
content_pk, has_group;
instr_event_log = foreach (join raw_instructor_activity by activity_name left outer, instr_count_mappings by activity_type) generate
instructor_hr_id, section_id, term_id, activity_pk, timestamp,
(instr_count_mappings::activity_name is null ? raw_instructor_activity::activity_type : instr_count_mappings::activity_name),
(instr_count_mappings::activity_type is null ? raw_instructor_activity::activity_name : instr_count_mappings::activity_type),
has_group;
store student_event_log into '/tmp/umuc/student_activity_all';
store instr_event_log into '/tmp/umuc/instructor_activity_all';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment