Example 4 : Loading Complex Datatypes (HandsOn)
Step 1 : Download complex data
Step 2 : Below is the schema for the data.
member = tuple(member_id:int
		, member_email:chararray
		, name:tuple(first_name:chararray, middle_name:chararray, last_name:chararray)
		, course_list:bag{course(course_name:chararray)}
		, technology:map[tech_name:chararray]
	    )
 
Step 3 : Upload data in hdfs first at /user/cloudera/Training/pig/complexData.txt
Step 4 : Now write Pig script using above schema to load the data and create a relation out of this.
hadoopexamMember = LOAD '/user/cloudera/Training/pig/complexData.txt' using PigStorage('|') 
    AS (member_id:int
    , member_email:chararray
    , name:tuple(first_name:chararray, middle_name:chararray, last_name:chararray)
    , course_list:bag{course: tuple(course_name:chararray)}
    , technology:map[chararray]
    ) ;
DESCRIBE hadoopexamMember ;
DUMP hadoopexamMember ;
Step 5 : Now find all the course lists subscribed by each member and its programming skills (To analyze , based on programming skills which all course they are interested in , so this results can be helpful to recommend same course list to similar member having same programming skills)
primaryProgramming = FOREACH hadoopexamMember GENERATE member_id, member_email, name.first_name, course_list, technology#'programming1' ;
DESCRIBE primaryProgramming ;
DUMP primaryProgramming ;