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




What is describe operator?

  • The describe operator is used to view the schema of a relation.
  • It Returns the schema of a relation.
  • DESCRIBE instruction:
    • Prints the schema of the relation 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 describe statement

    Syntax:

    • The syntax of the describe operator is as follows −
    grunt> Describe Relation_name
    

    Usage:

    • Use the DESCRIBE operator to view the schema of a relation.
    • You can view outer relations as well as relations defined in a nested FOREACH statement.

    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, describe the relation named student and verify the schema as shown below.
     grunt> describe student;
    
    • Once you execute the above Pig Latin statement, it will produce the following output.
    grunt> student: { id: int,firstname: chararray,lastname: chararray,phone: chararray,city: chararray }
    

    Related Searches to Apache Pig Describe Operator

    Adblocker detected! Please consider reading this notice.

    We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

    We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

    We need money to operate the site, and almost all of it comes from our online advertising.

    Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

    ×