- Apache Pig 教程
- Apache Pig - 主頁
- Apache Pig 簡介
- Apache Pig - 概述
- Apache Pig - 架構
- Apache Pig 環境
- Apache Pig - 安裝
- Apache Pig - 執行
- Apache Pig - Grunt Shell
- Pig Latin
- Pig Latin - 基礎
- 載入 & 儲存運算子
- Apache Pig - 讀取資料
- Apache Pig - 儲存資料
- 診斷運算子
- Apache Pig - 診斷運算子
- Apache Pig - Describe 運算子
- Apache Pig - Explain 運算子
- Apache Pig - Illustrate 運算子
- 分組 & 連線
- Apache Pig - Group 運算子
- Apache Pig - Cogroup 運算子
- Apache Pig - Join 運算子
- Apache Pig - Cross 運算子
- Pig Latin 內建函式
- Apache Pig - Eval 函式
- 載入 & 儲存函式
- Apache Pig - Bag & Tuple 函式
- Apache Pig - 字串函式
- Apache Pig - 日期時間函式
- Apache Pig - 數學函式
- Apache Pig 有用資源
- Apache Pig - 快速指南
- Apache Pig - 有用資源
- Apache Pig - 討論
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://: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 }
廣告