
Pig
「已注销」
这个作者很懒,什么都没留下…
展开
-
【pig】pig的注释格式
pig的注释格式共有两种: If you place Pig Latin statements in a script, the script can include comments. For multi-line comments use /* …. */ For single line comments use -- /* myscript.pig My原创 2012-12-24 20:39:44 · 6726 阅读 · 0 评论 -
Hortonworks member of technical staff戴建勇解读Apache Pig的性能优化
以下为现场实录: 什么是Apache Pig?ApachePig包括两个部分,首先是PigLatin的语言,是类SQL的数据处理语言。其次,Apache Pig是在Hadoop这个软件上运行Pig Latin语言的执行引擎,一部分是语言的部分,还有一部分是实践的部分。 比较一下Pig和Hadoop,跟Hadoop相比Pig具有更快的开发效率,所以可以用更少的代码实现和MapRed转载 2014-11-25 23:50:33 · 1707 阅读 · 0 评论 -
Pig性能优化
Pig性能优化 1. 尽早去除无用的数据 MapReduce Job的很大一部分开销在于磁盘IO和数据的网络传输,如果能尽早的去除无用的数据,减少数据量,会提升Pig的性能。 1). 尽早的使用Filter 使用Filter可以去除数据中无用的行(Record),尽早的Filter掉无用的数据,可以减少数据量,提升Pig性能。 2). 尽早的使用Project(F转载 2014-11-25 23:57:57 · 865 阅读 · 0 评论 -
【pig】pig脚本规范
1. 注释方式 a) . -- b). /* */ 示例: /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with thi原创 2013-01-21 19:26:15 · 1322 阅读 · 0 评论 -
【pig】TOKENIZE函数用法
TOKENIZE 分割函数的使用: 1. 假设有如下两个文件:test_tokenize.pig, log log 内容如下: --------------------------------------- 1 abc,zhoujie 2 mmm,liudehua 3 nnn*zhourunfa 0 nnn()zhouxingchi 5原创 2013-01-21 16:07:33 · 5654 阅读 · 0 评论 -
【pig】为udf打jar包
cd myudfs javac -cp pig.jar UPPER.java cd .. jar -cf myudfs.jar myudfs原创 2013-01-21 15:05:12 · 1179 阅读 · 0 评论 -
【pig】Error Handling
We saw an example of this when the Pow function detected overflow: for (int i = 0; i < exponent; i++) { long preresult = result; result *= base; if (preresult > result) { // We overflowed. Give a wa原创 2013-01-16 19:51:25 · 688 阅读 · 0 评论 -
【pig】内存管理
Memory Management Pig allocates a fix amount of memory to store bags and spills to disk as soon as the memory limit is reached. This is very similar to how Hadoop decides when to spill data accum原创 2013-01-11 15:47:37 · 992 阅读 · 0 评论 -
【pig】foreach使用*代表所有fields
A = load 'foreach_input' as (user:chararray, id:long, address:chararray, phone:chararray); --B = foreach A generate user, id; B = foreach A generate user, id, 'good'; --describe A; --describe B;原创 2013-01-08 15:01:45 · 756 阅读 · 0 评论 -
【pig】foreach 生成常量
A = load 'foreach_input' as (user:chararray, id:long, address:chararray, phone:chararray); --B = foreach A generate user, id; B = foreach A generate user, id, 'good'; dump B; 注:'good'是常量原创 2013-01-08 14:50:54 · 1030 阅读 · 0 评论 -
pig系列教程地址
http://www.codelast.com/?p=4550转载 2013-01-09 00:04:55 · 798 阅读 · 0 评论 -
【pig】foreach 中对bag进行count
测试数据文件foreach_bag.log,内容如下: {('b', 55), ('sally', 52), ('john', 25)} {('c', 355), ('msally', 352), ('mjohn', 325)} foreach_bag.pig代码如下: A = LOAD 'foreach_bag.log' as (b:bag{t:(x:chararray, y:int原创 2013-01-08 16:00:34 · 1307 阅读 · 0 评论 -
【pig】挑选合适的数据类型(待翻译)
As discussed elsewhere, Pig can run with or without data type information. In cases where the load function you are using creates data that is already typed, there is little you need to do to optimi翻译 2013-01-07 13:31:32 · 770 阅读 · 0 评论 -
【pig】pig的vim高亮设置
1. 到http://www.vim.org/scripts/script.php?script_id=2186下载pig.vim 2. copy pig.vim file into your ~/.vim/syntax/ directory; 3. add the following three lines to your ~/.vimrc file: augroup filetype原创 2013-01-04 13:33:27 · 2571 阅读 · 0 评论 -
【programming pig】preliminary matters
1. pig中relation名字和field名字不能重新赋值,因为会造成引用丢失 you can write as follows, A = load 'NYSE_dividends' (exchange, symbol, date, dividends); A = filter A by dividends > 0; A = foreach A generate UPPER(symbo原创 2012-12-27 18:23:31 · 626 阅读 · 0 评论 -
【programming pig】foreach语法
prices = load 'NYSE_daily' as (exchange, symbol, date, open, high, low, close, volume, adj_close); gain = foreach prices generate close - open; gain2 = foreach prices generate $6 - $3; Field原创 2012-12-27 23:05:16 · 900 阅读 · 0 评论 -
【pig】load操作
1. divs = load 'NYSE_dividends' using PigStorage(','); NYSE_dividends为相对路径(相对于hdfs空间下/user/yourlogin/),load的input路径可以是目录,也可以是文件 分隔符为",",通过参数传给PigStorage。 2. divs = load 'NYSE_dividends' as (excha原创 2012-12-27 22:47:02 · 2595 阅读 · 0 评论 -
pig cookbook学习
Overview 近期需要用pig做一些统计,由于没有系统学习,总是出现一些问题,且不容易调试,执行效率也不高。所以打算看一些官方文档,在此做些笔记。 pig性能提升 指定类型 如果在load文件时不指定类型,pig在计算时会指定为double类型,而在很多时候,数据本应是整形等,指定为double类型会增加广计算量。另外,指定类型也会使错误提早暴露出来。 --Query转载 2014-11-26 00:00:05 · 774 阅读 · 0 评论