pig tutorial - apache pig tutorial - Apache Pig - Illustrate Operator - pig latin - apache pig - pig hadoop




What is illustrate operator?

  • The illustrate operator gives you the step-by-step execution of a sequence of statements.
  • ILLUSTRATE operator is used to review how data is transformed through a sequence of Pig Latin statements.
  • ILLUSTRATE command is your best friend when it comes to debugging a script.
  • ILLUSTRATE instruction:
    • Prints the schema of the relation and a tuple example at standard output
    learn apache pig - apache pig tutorial - pig tutorial - apache pig examples - big data - apache pig script - apache pig program - apache pig download - apache pig example  -apache pig illustrate statement

    Syntax:

    The syntax of the illustrate operator is

    grunt> illustrate Relation_name;
    

    Example:

    Assume we have a file student_data.txt in HDFS with the following content.

    001, Aadhira,Arushi,9848022337, Delhi
    002, Mahi,Champa,9848022338, Chennai
    003, Avantika,charu,9848022339, Pune
    004, Samaira,Hansa,9848022330, Kolkata
    005, Abhinav,Akaash,9848022336,Bhuwaneshwar
    006, Amarjeet,Aksat,9848022335, Hyderabad
    

    And read it into a relation student using the LOAD operator as shown below.

    grunt> student = LOAD 'hdfs://localhost:9000/pig_data/student_data.txt' USING PigStorage(',')
       as ( id:int, firstname:chararray, lastname:chararray, phone:chararray, city:chararray );
    

    Now, illustrate the relation named student as shown below.

    grunt> illustrate student;
    

    Output:

    On executing the above statement, you will get the following output.

    grunt> illustrate student;
    
    INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapOnly$M ap - Aliases
    being processed per job phase (AliasName[line,offset]): M: student[1,10] C:  R:
    ------------------------------------------------------------------------------------------------------
    |student | id:int | firstname:chararray | lastname:chararray | phone:chararray | city:chararray|
    ------------------------------------------------------------------------------------------------------
    |               | 002  | mahi                           |  champa                    |  9848022338       |  chennai      |
    ------------------------------------------------------------------------------------------------------
    

    Related Searches to Apache Pig - Illustrate Operator