`

Pig: Introduction to Latin - 1

    博客分类:
  • Pig
 
阅读更多
  • Relation and Field

Pig Latin is a dataflow language. Each processing step results in a new data set, or relation.

A = load 'NYSE_dividends' (exchange, symbol, date, dividends);

//A is relation      exchange,symbol,date and dividends are all fields

 

  • Case Sensitivity

Keywords in Pig Latin are not case-sensitive; for example, LOAD is equivalent to load. But relation and field names are.UDF names are also case-sensitive, thus COUNT is not the same UDF as count.

 

  • Comments

A = load 'foo'; --this is a single-line comment
/*
* This is a multiline comment.
*/
B = load /* a comment in the middle */'bar';

 

  • Load

PigStorage and TextLoader

divs = load '/data/examples/NYSE_dividends';      //tab-delimited file

divs = load 'NYSE_dividends' using HBaseStorage();  //load from hbase

divs = load 'NYSE_dividends' using PigStorage(',');    //comma-separated text data

divs = load 'NYSE_dividends' as (exchange, symbol, date, dividends);  //specify the schema

divs = load 'datadir'; // read all files recursively in the datadir

divs = load 'datadir/part-2012-*';  //read multiple files in datadir



 

  • Store

store processed into '/data/examples/processed';

store processed into 'processed' using HBaseStorage();

store processed into 'processed' using PigStorage(',');

 

Note:when writing to a filesystem, processed will be a directory with part files rather than a single file. But how many part files will be created? That depends on the parallelism of the last job before the store. If it has re-duces, it will be determined by the parallel level set for that job.  If it is a map-only job, it will be determined by the number of maps, which is controlled by Hadoop and not Pig.

 

  • Dump

dump processed;  //sent contents of processed to console

 

  • 大小: 49.5 KB
分享到:
评论

相关推荐

    Pig Latin: A Not-So-Foreign Language for Data Processing

    ### Pig Latin:一种用于数据处理的“非外语” #### 概述 《Pig Latin: A Not-So-Foreign Language for Data Processing》是一篇由Christopher Olston、Benjamin Reed、Utkarsh Srivastava、Ravi Kumar以及Andrew ...

    captcha-core-2.2.1-API文档-中英对照版.zip

    标签:pig4cloud、core、plugin、captcha、jar包、java、中英对照文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明...

    oss-spring-boot-starter-1.0.3-API文档-中英对照版.zip

    标签:pig4cloud、spring、plugin、starter、boot、oss、jar包、java、中英对照文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持...

    nacos-consistency-2.0.4.RELEASE-API文档-中文版.zip

    标签:pig4cloud、consistency、nacos、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准...

    日常生活英语单词必背.doc

    1. 人体部分: - foot:脚 - head:头 - face:脸 - hair:头发 - nose:鼻子 - mouth:嘴 - eye:眼睛 - ear:耳朵 - arm:手臂 - hand:手 - finger:手指 - leg:腿 - tail:尾巴 2. 颜色: - red...

    Pep小学英语总复习单词归类表.doc

    1. 学习用品(School Things): - pen:钢笔 - pencil:铅笔 - pencil-case:铅笔盒 - ruler:尺子 - bag:包 - eraser:橡皮 - comic book:漫画书 - schoolbag:书包 - book:书 - crayon:蜡笔 - ...

    excel-spring-boot-starter-1.1.1-API文档-中文版.zip

    标签:pig4cloud、excel、spring、starter、boot、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和...

    冀教版小学英语总复习资料全.doc

    1. 学习用品类: - pen: 钢笔 - pencil: 铅笔 - book: 书 - eraser: 橡皮 - ruler: 尺子 - pencil-case: 铅笔盒 - marker: 彩笔 - bag: 书包 - glue: 胶水 - scissors: 剪刀 - paper: 纸 - sharpener: ...

    外研社小学英语单词表默写.doc

    - 猪:pig - 鸡:chicken - 鸡蛋:egg - 瘦的:thin - 胖的:fat - 幼崽:cub - 小的:small - 大的:big - 粉红的:pink Module 6 更多动物和形容词的学习: - 蛇:snake 这些模块中的单词和短语都是小学英语学习...

    人教八年级上册单词短语句子翻译测试.doc

    1. 单词翻译: - 任何人:anyone - 在任何地方:anywhere - 精彩的:wonderful - 不多,很少:not many, seldom - 大多数:most - 某物:something - 没有什么:nothing - 每人:everyone - 我自己:myself...

    captcha-core-2.2.1-API文档-中文版.zip

    标签:pig4cloud、core、plugin、captcha、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准...

    小学三年级英语单词表.doc

    - Unit 1:人物和问候语 - boy:男孩 - girl:女孩 - teacher:教师 - student:学生 - this:这个 - my:我的 - friend:朋友 - I'm=I am:我是 - nice:好的,愉快的 - good morning:早上好 - good ...

    小学英语总复习词汇专项练习.doc

    1. **学习用品(school things)** - 钢笔:pen - 铅笔:pencil - 铅笔盒:pencil case - 尺子:ruler - 书:book - 明信片:postcard - 漫画书:comic book - 包:bag - 报纸:newspaper - 书包:school ...

    nacos-naming-2.0.4.RELEASE-API文档-中文版.zip

    标签:pig4cloud、naming、nacos、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请...

    excel-spring-boot-starter-1.1.1-API文档-中英对照版.zip

    标签:pig4cloud、excel、spring、starter、boot、jar包、java、中英对照文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,...

    nacos-api-2.0.4.RELEASE-API文档-中文版.zip

    标签:pig4cloud、api、nacos、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请...

    oss-spring-boot-starter-1.0.3-API文档-中文版.zip

    对应Maven信息:groupId:com.pig4cloud.plugin,artifactId:oss-spring-boot-starter,version:1.0.3 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中...

    nacos-auth-2.0.4.RELEASE-API文档-中文版.zip

    标签:pig4cloud、auth、nacos、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译,请...

    nacos-consistency-2.0.4.RELEASE-API文档-中英对照版.zip

    标签:pig4cloud、consistency、nacos、jar包、java、中英对照文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明...

    nacos-naming-2.0.4.RELEASE-API文档-中英对照版.zip

    标签:pig4cloud、naming、nacos、jar包、java、中英对照文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明精准翻译...

Global site tag (gtag.js) - Google Analytics