📜  Apache Pig-说明运算符

📅  最后修改于: 2020-12-02 05:34:09             🧑  作者: Mango


说明运算符使您可以逐步执行一系列语句。

句法

下面给出了Illustra运算符的语法。

grunt> illustrate Relation_name;

假设我们在HDFS中有一个具有以下内容的文件Student_data.txt

001,Rajiv,Reddy,9848022337,Hyderabad
002,siddarth,Battacharya,9848022338,Kolkata 
003,Rajesh,Khanna,9848022339,Delhi
004,Preethi,Agarwal,9848022330,Pune 
005,Trupthi,Mohanthy,9848022336,Bhuwaneshwar
006,Archana,Mishra,9848022335,Chennai.

如下所示,我们已使用LOAD运算符将其读入关系学生

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

现在,让我们说明一下名为student的关系,如下所示。

grunt> illustrate student;

输出

执行上述语句后,您将获得以下输出。

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    | siddarth            | Battacharya        | 9848022338      | Kolkata        |
---------------------------------------------------------------------------------------------