Apache Pig Describe运算符

describe 运算符用于查看关系的模式。

语法

describe 运算符的语法如下


grunt> Describe 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运算符将它读入关系 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> describe student;

输出

执行上述 Pig Latin 语句后,将生成以下输出。

grunt> student: { id: int,firstname: chararray,lastname: chararray,phone: chararray,city: chararray }


联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2022

备案号:京ICP备15003423号-3