- 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 - TextLoader()
Pig Latin 函式TextLoader()是一個載入函式,用於載入UTF-8格式的非結構化資料。
語法
以下是TextLoader()函式的語法。
grunt> TextLoader()
示例
假設在名為/data/的HDFS目錄下有一個名為stu_data.txt的檔案,內容如下所示。
001,Rajiv_Reddy,21,Hyderabad 002,siddarth_Battacharya,22,Kolkata 003,Rajesh_Khanna,22,Delhi 004,Preethi_Agarwal,21,Pune 005,Trupthi_Mohanthy,23,Bhuwaneshwar 006,Archana_Mishra,23,Chennai 007,Komal_Nayak,24,trivendram 008,Bharathi_Nambiayar,24,Chennai
現在讓我們使用TextLoader()函式載入上述檔案。
grunt> details = LOAD 'hdfs://:9000/pig_data/stu_data.txt' USING TextLoader();
您可以使用Dump運算子驗證載入的資料。
grunt> dump details; (001,Rajiv_Reddy,21,Hyderabad) (002,siddarth_Battacharya,22,Kolkata) (003,Rajesh_Khanna,22,Delhi) (004,Preethi_Agarwal,21,Pune) (005,Trupthi_Mohanthy,23,Bhuwaneshwar) (006,Archana_Mishra,23,Chennai) (007,Komal_Nayak,24,trivendram) (008,Bharathi_Nambiayar,24,Chennai)
apache_pig_load_store_functions.htm
廣告