Apache Pig 简明教程
Apache Pig - Illustrate Operator
illustrate 运算符为您提供了一系列语句的分步执行。
Example
假设我们在 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 运算符,将它读入到一个关系 student 中,如下所示。
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;
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 | siddarth | Battacharya | 9848022338 | Kolkata |
---------------------------------------------------------------------------------------------