<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7278761823670669478</id><updated>2024-09-24T18:31:20.793-07:00</updated><title type='text'>gerdas-stube</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gerdas-stube.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7278761823670669478/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://gerdas-stube.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7278761823670669478.post-3818083226567138237</id><published>2011-09-04T00:49:00.001-07:00</published><updated>2015-01-26T04:44:19.540-08:00</updated><title type='text'>Sujanpur Tihra</title><content type='html'>&lt;p&gt; 24 km from Hamirpur town and close to the district border of Kangra is the fort of Sujanpur. This place was the capital of Katoch Dynasty and the old fort is worth visiting. Popularly known alongwith its twin title &#39;Tira&#39;, this fort was built by Raja Abhaya Chand of Kangra in 1758. In the early 19th century this was the home of the famous Raja Sansar Chand - renownded patron of the Kangra school of miniature paintings. The fort has a Barahdari Hall&#39;, where Sansar Chand used to hold court, some shrines and excellent wall paintings. &lt;/p&gt;    &lt;a rel=&quot;lightbox&quot; href=&quot;http://himachaltourism.gov.in/HimachalIT/image.axd?picture=2008%2f9%2fsujanpurfortnew.jpg&quot;&gt;    &lt;p style=&quot;text-align: center;&quot;&gt;    &lt;img src=&quot;http://himachaltourism.gov.in/HimachalIT/image.axd?picture=2008%2f9%2fsujanpurfortnew.jpg&quot; alt=&quot;&quot; height=&quot;412&quot; width=&quot;550&quot; /&gt;     &lt;/p&gt;    &lt;p align=&quot;center&quot;&gt;    &lt;em&gt;&lt;strong&gt;Remanants of Sujanpur Fort&lt;/strong&gt;&lt;/em&gt;     &lt;/p&gt;    &lt;/a&gt;    &lt;p&gt; There is a huge ground, where the annual Holi fair is held for 3-4 days, besides being used for sport activities. A Sainik school is also located here. It is also a religious centre. Narbadeshwar, Gauri Shankar and Murli Manohar are the three well known temples in the town. By the waters of the river Beas, the town has a charming setting and the river stretch offers good angling opportunities. This place is suitable for other adventure sports as well, such as angling, rafting and trekking. &lt;/p&gt;    &lt;a rel=&quot;lightbox&quot; href=&quot;http://himachaltourism.gov.in/HimachalIT/image.axd?picture=2008%2f9%2fsujanpurtihraground.jpg&quot;&gt;    &lt;p style=&quot;text-align: center;&quot;&gt;    &lt;img src=&quot;http://himachaltourism.gov.in/HimachalIT/image.axd?picture=2008%2f9%2fsujanpurtihraground.jpg&quot; alt=&quot;&quot; height=&quot;412&quot; width=&quot;550&quot; /&gt;     &lt;/p&gt;    &lt;p align=&quot;center&quot;&gt;    &lt;em&gt;&lt;strong&gt;Sujanpur Ground &lt;/strong&gt;&lt;/em&gt;    &lt;/p&gt;    &lt;/a&gt;    &lt;p&gt;         &lt;/p&gt;&lt;p style=&#39;display:none&#39;&gt;26836f82e46040fca5a806badc0036547afa3dbd&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://gerdas-stube.blogspot.com/feeds/3818083226567138237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gerdas-stube.blogspot.com/2011/09/sujanpur-tihra.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7278761823670669478/posts/default/3818083226567138237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7278761823670669478/posts/default/3818083226567138237'/><link rel='alternate' type='text/html' href='http://gerdas-stube.blogspot.com/2011/09/sujanpur-tihra.html' title='Sujanpur Tihra'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7278761823670669478.post-658782534455251811</id><published>2010-10-26T03:36:00.000-07:00</published><updated>2016-01-29T00:51:33.741-08:00</updated><title type='text'>Pig Operator - Hadoop</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;
Basic Operators&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Arithmetic Operators&lt;/td&gt;
&lt;td&gt;+, -, *, /, %, ?:&lt;/td&gt;
&lt;td&gt;X = FOREACH A GENERATE f1, f2, f1%f2;&lt;br /&gt;
X = FOREACH A GENERATE f2, (f2==1?1:COUNT(B));&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Boolean Operators&lt;/td&gt;
&lt;td&gt;and, or, not&lt;/td&gt;
&lt;td&gt;X = FILTER A BY (f1==8) OR (NOT (f2+f3 &amp;gt; f1));&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cast Operators&lt;/td&gt;
&lt;td&gt;Casting from one datatype to another&lt;/td&gt;
&lt;td&gt;B = FOREACH A GENERATE (int)$0 + 1;&lt;br /&gt;
B = FOREACH A GENERATE $0 + 1, $1 + 1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Comparison Operators&lt;/td&gt;
&lt;td&gt;==, !=, &amp;gt;, &amp;lt;, &amp;gt;=, &amp;lt;=, matches&lt;/td&gt;
&lt;td&gt;X = FILTER A BY (f1 == 8);&lt;br /&gt;
X = FILTER A BY (f2 == ‘apache’);&lt;br /&gt;
X = FILTER A BY (f1 matches ‘.*apache.*’);&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Construction Operators&lt;/td&gt;
&lt;td&gt;Used to construct tuple (), bag {} and map []&lt;/td&gt;
&lt;td&gt;B = foreach A generate (name, age);&lt;br /&gt;
B = foreach A generate {(name, age)}, {name, age};&lt;br /&gt;
B = foreach A generate [name, gpa];&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dereference Operators&lt;/td&gt;
&lt;td&gt;dereference tuples (tuple.id or tuple.(id,…)), bags (bag.id or bag.(id,…)) and maps (map#’key’)&lt;/td&gt;
&lt;td&gt;X = FOREACH A GENERATE f2.t1,f2.t3 (dereferencing is used to retrieve two fields from tuple f2)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disambiguate Operator&lt;/td&gt;
&lt;td&gt;( :: ) used to identify field names after JOIN, COGROUP, CROSS, or FLATTEN operators&lt;/td&gt;
&lt;td&gt;A = load ‘data1′ as (x, y);&lt;br /&gt;
B = load ‘data2′ as (x, y, z);&lt;br /&gt;
C = join A by x, B by x;&lt;br /&gt;
D = foreach C generate A::y;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flatten Operator&lt;/td&gt;
&lt;td&gt;Flatten un-nests tuples as well as bags&lt;/td&gt;
&lt;td&gt;consider a relation that has a tuple of the form (a, (b, c)). The 
expression GENERATE $0, flatten($1), will cause that tuple to become (a,
 b, c).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Null Operator&lt;/td&gt;
&lt;td&gt;is null, is not null&lt;/td&gt;
&lt;td&gt;X = FILTER A BY f1 is not null;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sign Operators&lt;/td&gt;
&lt;td&gt;+ -&amp;gt; has no effect, – -&amp;gt; changes the sign of a positive/negative number&lt;/td&gt;
&lt;td&gt;A = LOAD ‘data’ as (x, y, z);&lt;br /&gt;
B = FOREACH A GENERATE -x, y;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;Relational_Operators&quot;&gt;&lt;/a&gt;Relational Operators&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;COGROUP/GROUP&lt;/td&gt;
&lt;td&gt;Groups the data in one or more relations. The COGROUP operator groups together tuples that have the same group key (key field)&lt;/td&gt;
&lt;td&gt;A = load ‘student’ AS (name:chararray,age:int,gpa:float);&lt;br /&gt;
B = GROUP A BY age;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CROSS&lt;/td&gt;
&lt;td&gt;Computes the cross product of two or more relations&lt;/td&gt;
&lt;td&gt;X = CROSS A,B A = (1, 2, 3) B = (2, 4)&lt;br /&gt;
DUMP X; (4, 2, 1) (8, 9)&lt;br /&gt;
(1,2,3,2,4) (1, 3)&lt;br /&gt;
(1,2,3,8,9)&lt;br /&gt;
(1,2,3,1,3)&lt;br /&gt;
(4,2,1,2,4)&lt;br /&gt;
(4,2,1,8,9)&lt;br /&gt;
(4,2,1,1,3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DEFINE&lt;/td&gt;
&lt;td&gt;Assigns an alias to a UDF or streaming command.&lt;/td&gt;
&lt;td&gt;DEFINE CMD `perl PigStreaming.pl – nameMap` input(stdin using PigStreaming(‘,’)) output(stdout using PigStreaming(‘,’));&lt;br /&gt;
A = LOAD ‘file’;&lt;br /&gt;
B = STREAM B THROUGH CMD;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DISTINCT&lt;/td&gt;
&lt;td&gt;Removes duplicate tuples in a relation.&lt;/td&gt;
&lt;td&gt;X = DISTINCT A; A = (8,3,4)&lt;br /&gt;
DUMP X; (1,2,3)&lt;br /&gt;
(1,2,3) (4,3,3)&lt;br /&gt;
(4,3,3) (4,3,3)&lt;br /&gt;
(8,3,4) (1,2,3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FILTER&lt;/td&gt;
&lt;td&gt;Selects tuples from a relation based on some condition.&lt;/td&gt;
&lt;td&gt;X = FILTER A BY f3 == 3; A = (1,2,3)&lt;br /&gt;
DUMP X; (4,5,6)&lt;br /&gt;
(1,2,3) (7,8,9)&lt;br /&gt;
(4,3,3) (4,3,3)&lt;br /&gt;
(8,4,3) (8,4,3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FOREACH&lt;/td&gt;
&lt;td&gt;Generates transformation of data for each row as specified&lt;/td&gt;
&lt;td&gt;X = FOREACH A GENERATE a1, a2; A = (1,2,3)&lt;br /&gt;
DUMP X; (4,2,5)&lt;br /&gt;
(1,2) (8,3,6)&lt;br /&gt;
(4,2)&lt;br /&gt;
(8,3)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IMPORT&lt;/td&gt;
&lt;td&gt;Import macros defined in a separate file.&lt;/td&gt;
&lt;td&gt;/* myscript.pig */&lt;br /&gt;
IMPORT ‘my_macro.pig’;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JOIN&lt;/td&gt;
&lt;td&gt;Performs an inner join of two or more relations based on common field values.&lt;/td&gt;
&lt;td&gt;X = JOIN A BY a1, B BY b1;&lt;br /&gt;
DUMP X&lt;br /&gt;
(1,2,1,3) A = (1,2) B = (1,3)&lt;br /&gt;
(1,2,1,2) (4,5) (1,2)&lt;br /&gt;
(4,5,4,7) (4,7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOAD&lt;/td&gt;
&lt;td&gt;Loads data from the file system.&lt;/td&gt;
&lt;td&gt;A = LOAD ‘myfile.txt’;&lt;br /&gt;
LOAD ‘myfile.txt’ AS (f1:int, f2:int, f3:int);&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MAPREDUCE&lt;/td&gt;
&lt;td&gt;Executes native MapReduce jobs inside a Pig script.&lt;/td&gt;
&lt;td&gt;A = LOAD ‘WordcountInput.txt’;&lt;br /&gt;
B = MAPREDUCE ‘wordcount.jar’ STORE A INTO ‘inputDir’ LOAD ‘outputDir’&lt;br /&gt;
AS (word:chararray, count: int) `org.myorg.WordCount inputDir outputDir`;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ORDERBY&lt;/td&gt;
&lt;td&gt;Sorts a relation based on one or more fields.&lt;/td&gt;
&lt;td&gt;A = LOAD ‘mydata’ AS (x: int, y: map[]);&lt;br /&gt;
B = ORDER A BY x;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SAMPLE&lt;/td&gt;
&lt;td&gt;Partitions a relation into two or more relations, selects a random data sample with the stated sample size.&lt;/td&gt;
&lt;td&gt;Relation X will contain 1% of the data in relation A.&lt;br /&gt;
A = LOAD ‘data’ AS (f1:int,f2:int,f3:int);&lt;br /&gt;
X = SAMPLE A 0.01;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SPLIT&lt;/td&gt;
&lt;td&gt;Partitions a relation into two or more relations based on some expression.&lt;/td&gt;
&lt;td&gt;SPLIT input_var INTO output_var IF (field1 is not null), ignored_var IF (field1 is null);&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;STORE&lt;/td&gt;
&lt;td&gt;Stores or saves results to the file system.&lt;/td&gt;
&lt;td&gt;STORE A INTO ‘myoutput’ USING PigStorage (‘*’);&lt;br /&gt;
1*2*3&lt;br /&gt;
4*2*1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;STREAM&lt;/td&gt;
&lt;td&gt;Sends data to an external script or program&lt;/td&gt;
&lt;td&gt;A = LOAD ‘data’;&lt;br /&gt;
B = STREAM A THROUGH `stream.pl -n 5`;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UNION&lt;/td&gt;
&lt;td&gt;Computes the union of two or more relations. (Does not preserve the order of tuples)&lt;/td&gt;
&lt;td&gt;X = UNION A, B; A = (1,2,3) B = (2,4)&lt;br /&gt;
DUMP X; (4,2,1) (8,9)&lt;br /&gt;
(1,2,3) (1,3)&lt;br /&gt;
(4,2,1)&lt;br /&gt;
(2,4)&lt;br /&gt;
(8,9)&lt;br /&gt;
(1,3)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;Functions&quot;&gt;&lt;/a&gt;Functions&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;AVG&lt;/td&gt;
&lt;td&gt;AVG(expression&lt;/td&gt;
&lt;td&gt;Computes the average of the numeric values in a single-column bag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CONCAT&lt;/td&gt;
&lt;td&gt;CONCAT (expression, expression)&lt;/td&gt;
&lt;td&gt;Concatenates two expressions of identical type.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COUNT&lt;/td&gt;
&lt;td&gt;COUNT(expression)&lt;/td&gt;
&lt;td&gt;Computes the number of elements in a bag, it ignores null.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COUNT_STAR&lt;/td&gt;
&lt;td&gt;COUNT_STAR(expression)&lt;/td&gt;
&lt;td&gt;Computes the number of elements in a bag, it includes null.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DIFF&lt;/td&gt;
&lt;td&gt;DIFF (expression, expression)&lt;/td&gt;
&lt;td&gt;Compares two fields in a tuple, any tuples that are in one bag but not the other are returned in a bag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DIFF&lt;/td&gt;
&lt;td&gt;DIFF (expression, expression)&lt;/td&gt;
&lt;td&gt;Compares two fields in a tuple, any tuples that are in one bag but not the other are returned in a bag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IsEmpty&lt;/td&gt;
&lt;td&gt;IsEmpty(expression)&lt;/td&gt;
&lt;td&gt;Checks if a bag or map is empty.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MAX&lt;/td&gt;
&lt;td&gt;MAX(expression)&lt;/td&gt;
&lt;td&gt;Computes the maximum of the numeric values or chararrays in a single-column bag&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MIN&lt;/td&gt;
&lt;td&gt;MIN(expression)&lt;/td&gt;
&lt;td&gt;Computes the minimum of the numeric values or chararrays in a single-column bag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SIZE&lt;/td&gt;
&lt;td&gt;SIZE(expression)&lt;/td&gt;
&lt;td&gt;Computes the number of elements based on any Pig data type. SIZE includes NULL values in the size computation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUM&lt;/td&gt;
&lt;td&gt;SUM(expression)&lt;/td&gt;
&lt;td&gt;Computes the sum of the numeric values in a single-column bag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TOKENIZE&lt;/td&gt;
&lt;td&gt;TOKENIZE(expression [, &#39;field_delimiter&#39;])&lt;/td&gt;
&lt;td&gt;Splits a string and outputs a bag of words.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;Load_Store_Functions&quot;&gt;&lt;/a&gt;Load/Store Functions&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;FUnction&lt;/th&gt;
&lt;th&gt;Syntax&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Handling Compression&lt;/td&gt;
&lt;td&gt;A = load ‘myinput.gz’;&lt;br /&gt;
store A into ‘myoutput.gz’;&lt;/td&gt;
&lt;td&gt;PigStorage and TextLoader support gzip and bzip compression for both
 read (load) and write (store). BinStorage does not support compression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BinStorage&lt;/td&gt;
&lt;td&gt;A = LOAD ‘data’ USING BinStorage();&lt;/td&gt;
&lt;td&gt;Loads and stores data in machine-readable format.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JsonLoader, JsonStorage&lt;/td&gt;
&lt;td&gt;A = load ‘a.json’ using JsonLoader();&lt;/td&gt;
&lt;td&gt;Load or store JSON data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PigDump&lt;/td&gt;
&lt;td&gt;STORE X INTO ‘output’ USING PigDump();&lt;/td&gt;
&lt;td&gt;Stores data in UTF-8 format.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PigStorage&lt;/td&gt;
&lt;td&gt;A = LOAD ‘student’ USING PigStorage(‘\t’) AS (name: chararray, age:int, gpa: float);&lt;/td&gt;
&lt;td&gt;Loads and stores data as structured text files.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TextLoader&lt;/td&gt;
&lt;td&gt;A = LOAD ‘data’ USING TextLoader();&lt;/td&gt;
&lt;td&gt;Loads unstructured data in UTF-8 format.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;Math_Functions&quot;&gt;&lt;/a&gt;Math Functions&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ABS&lt;/td&gt;
&lt;td&gt;ABS(expression)&lt;/td&gt;
&lt;td&gt;Returns the absolute value of an expression. If the result is not 
negative (x ≥ 0), the result is returned. If the result is negative (x 
&amp;lt; 0), the negation of the result is returned.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ACOS&lt;/td&gt;
&lt;td&gt;ACOS(expression)&lt;/td&gt;
&lt;td&gt;Returns the arc cosine of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ASIN&lt;/td&gt;
&lt;td&gt;ASIN(expression)&lt;/td&gt;
&lt;td&gt;Returns the arc sine of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ATAN&lt;/td&gt;
&lt;td&gt;ATAN(expression)&lt;/td&gt;
&lt;td&gt;Returns the arc tangent of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CBRT&lt;/td&gt;
&lt;td&gt;CBRT(expression)&lt;/td&gt;
&lt;td&gt;Returns the cube root of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CEIL&lt;/td&gt;
&lt;td&gt;CEIL(expression)&lt;/td&gt;
&lt;td&gt;Returns the value of an expression rounded up to the nearest integer. This function never decreases the result value.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COS&lt;/td&gt;
&lt;td&gt;COS(expression)&lt;/td&gt;
&lt;td&gt;Returns the trigonometric cosine of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COSH&lt;/td&gt;
&lt;td&gt;COSH(expression)&lt;/td&gt;
&lt;td&gt;Returns the hyperbolic cosine of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EXP&lt;/td&gt;
&lt;td&gt;EXP(expression)&lt;/td&gt;
&lt;td&gt;Returns Euler’s number e raised to the power of x.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FLOOR&lt;/td&gt;
&lt;td&gt;FLOOR(expression)&lt;/td&gt;
&lt;td&gt;Returns the value of an expression rounded down to the nearest integer. This function never increases the result value.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOG&lt;/td&gt;
&lt;td&gt;LOG(expression)&lt;/td&gt;
&lt;td&gt;Returns the natural logarithm (base e) of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOG10&lt;/td&gt;
&lt;td&gt;LOG10(expression)&lt;/td&gt;
&lt;td&gt;Returns the base 10 logarithm of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RANDOM&lt;/td&gt;
&lt;td&gt;RANDOM( )&lt;/td&gt;
&lt;td&gt;Returns a pseudo random number (type double) greater than or equal to 0.0 and less than 1.0.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ROUND&lt;/td&gt;
&lt;td&gt;ROUND(expression)&lt;/td&gt;
&lt;td&gt;Returns the value of an expression rounded to an integer (if the 
result type is float) or rounded to a long (if the result type is 
double).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SIN&lt;/td&gt;
&lt;td&gt;SIN(expression)&lt;/td&gt;
&lt;td&gt;Returns the sine of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SINH&lt;/td&gt;
&lt;td&gt;SINH(expression)&lt;/td&gt;
&lt;td&gt;Returns the hyperbolic sine of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQRT&lt;/td&gt;
&lt;td&gt;SQRT(expression)&lt;/td&gt;
&lt;td&gt;Returns the positive square root of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TAN&lt;/td&gt;
&lt;td&gt;TAN(expression)&lt;/td&gt;
&lt;td&gt;Returns the trignometric tangent of an angle.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TANH&lt;/td&gt;
&lt;td&gt;TANH(expression)&lt;/td&gt;
&lt;td&gt;Returns the hyperbolic tangent of an expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;String_Functions&quot;&gt;&lt;/a&gt;String Functions&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;INDEXOF&lt;/td&gt;
&lt;td&gt;INDEXOF(string, ‘character’, startIndex)&lt;/td&gt;
&lt;td&gt;Returns the index of the first occurrence of a character in a string, searching forward from a start index.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LAST_INDEX&lt;/td&gt;
&lt;td&gt;LAST_INDEX_OF(expression)&lt;/td&gt;
&lt;td&gt;Returns the index of the last occurrence of a character in a string, searching backward from a start index.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LCFIRST&lt;/td&gt;
&lt;td&gt;LCFIRST(expression)&lt;/td&gt;
&lt;td&gt;Converts the first character in a string to lower case.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOWER&lt;/td&gt;
&lt;td&gt;LOWER(expression)&lt;/td&gt;
&lt;td&gt;Converts all characters in a string to lower case.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REGEX_EXTRACT&lt;/td&gt;
&lt;td&gt;REGEX_EXTRACT (string, regex, index)&lt;/td&gt;
&lt;td&gt;Performs regular expression matching and extracts the matched group 
defined by an index parameter. The function uses Java regular expression
 form.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REGEX_EXTRACT_ALL&lt;/td&gt;
&lt;td&gt;REGEX_EXTRACT (string, regex)&lt;/td&gt;
&lt;td&gt;Performs regular expression matching and extracts all matched groups. The function uses Java regular expression form.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REPLACE&lt;/td&gt;
&lt;td&gt;REPLACE(string, ‘oldChar’, ‘newChar’);&lt;/td&gt;
&lt;td&gt;Replaces existing characters in a string with new characters.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;STRSPLIT&lt;/td&gt;
&lt;td&gt;STRSPLIT(string, regex, limit)&lt;/td&gt;
&lt;td&gt;Splits a string around matches of a given regular expression.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUBSTRING&lt;/td&gt;
&lt;td&gt;SUBSTRING(string, startIndex, stopIndex)&lt;/td&gt;
&lt;td&gt;Returns a substring from a given string.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TRIM&lt;/td&gt;
&lt;td&gt;TRIM(expression)&lt;/td&gt;
&lt;td&gt;Returns a copy of a string with leading and trailing white space removed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UCFIRST&lt;/td&gt;
&lt;td&gt;UCFIRST(expression)&lt;/td&gt;
&lt;td&gt;Returns a string with the first character converted to upper case.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UPPER&lt;/td&gt;
&lt;td&gt;UPPER(expression)&lt;/td&gt;
&lt;td&gt;Returns a string converted to upper case.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;Tuple_Bag_Map_Functions&quot;&gt;&lt;/a&gt;Tuple, Bag, Map Functions&lt;/h1&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TOTUPLE&lt;/td&gt;
&lt;td&gt;TOTUPLE(expression [, expression ...])&lt;/td&gt;
&lt;td&gt;Converts one or more expressions to type tuple.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TOBAG&lt;/td&gt;
&lt;td&gt;TOBAG(expression [, expression ...])&lt;/td&gt;
&lt;td&gt;Converts one or more expressions to individual tuples which are then placed in a bag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TOMAP&lt;/td&gt;
&lt;td&gt;TOMAP(key-expression, value-expression [, key-expression, value-expression ...])&lt;/td&gt;
&lt;td&gt;Converts key/value expression pairs into a map. Needs an even number
 of expressions as parameters. The elements must comply with map type 
rules.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TOP&lt;/td&gt;
&lt;td&gt;TOP(topN,column,relation)&lt;/td&gt;
&lt;td&gt;Returns the top-n tuples from a bag of tuples.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;UDFs&quot;&gt;&lt;/a&gt;User Defined Functions (UDFs)&lt;/h1&gt;
Pig provides extensive support for user defined functions (UDFs) as a
 way to specify custom processing. Pig UDFs can currently be implemented
 in three languages: Java, Python, JavaScript and Ruby.&lt;br /&gt;
&lt;b&gt;Registering UDFs&lt;/b&gt;&lt;br /&gt;
Registering Java UDFs:&lt;br /&gt;
&lt;pre&gt;---register_java_udf.pig
register &#39;your_path_to_piggybank/piggybank.jar&#39;;
divs      = load &#39;NYSE_dividends&#39; as (exchange:chararray, symbol:chararray,
                date:chararray, dividends:float);&lt;/pre&gt;
Registering Python UDFs (The Python script must be in your current directory):&lt;br /&gt;
&lt;pre&gt;--register_python_udf.pig
register &#39;production.py&#39; using jython as bballudfs;
players  = load &#39;baseball&#39; as (name:chararray, team:chararray,
                pos:bag{t:(p:chararray)}, bat:map[]);&lt;/pre&gt;
&lt;b&gt;Writing UDFs&lt;/b&gt;&lt;br /&gt;
Java UDFs:&lt;br /&gt;
&lt;pre&gt;package myudfs;
import java.io.IOException;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;

public class UPPER extends EvalFunc
{
   public String exec(Tuple input) throws IOException {
       if (input == null || input.size() == 0)
           return null;
           try{
              String str = (String)input.get(0);
              return str.toUpperCase();
           }catch(Exception e){
              throw new IOException(&quot;Caught exception processing input row &quot;, e);
           }
      }
  }&lt;/pre&gt;
Python UDFs&lt;br /&gt;
&lt;pre&gt;#Square - Square of a number of any data type
@outputSchemaFunction(&quot;squareSchema&quot;) -- Defines a script delegate function that defines schema for this function depending upon the input type.
def square(num):
   return ((num)*(num))
@schemaFunction(&quot;squareSchema&quot;) --Defines delegate function and is not registered to Pig.
 def squareSchema(input):
   return input

 #Percent- Percentage
 @outputSchema(&quot;percent:double&quot;) --Defines schema for a script UDF in a format that Pig understands and is able to parse
 def percent(num, total):
   return num * 100 / total&lt;/pre&gt;
&lt;h1&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; name=&quot;Data_Types&quot;&gt;&lt;/a&gt;Data Types&lt;/h1&gt;
&lt;h3&gt;
Simple Types&lt;/h3&gt;
&lt;table class=&quot;table table-bordered table-striped&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;int&lt;/td&gt;
&lt;td&gt;Signed 32-bit integer&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;long&lt;/td&gt;
&lt;td&gt;Signed 64-bit integer&lt;/td&gt;
&lt;td&gt;Data: 10L or 10l&lt;br /&gt;
Display: 10L&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;float&lt;/td&gt;
&lt;td&gt;32-bit floating point&lt;/td&gt;
&lt;td&gt;Data: 10.5F or 10.5f or 10.5e2f or 10.5E2F&lt;br /&gt;
Display: 10.5F or 1050.0F&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;double&lt;/td&gt;
&lt;td&gt;64-bit floating point&lt;/td&gt;
&lt;td&gt;Data: 10.5 or 10.5e2 or 10.5E2&lt;br /&gt;
Display: 10.5 or 1050.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;chararray&lt;/td&gt;
&lt;td&gt;Character array (string) in Unicode UTF-8 format&lt;/td&gt;
&lt;td&gt;hello world&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;bytearray&lt;/td&gt;
&lt;td&gt;Byte array (blob)&lt;/td&gt;
&lt;td&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;boolean&lt;/td&gt;
&lt;td&gt;boolean&lt;/td&gt;
&lt;td&gt;true/false (case insensitive) &lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://gerdas-stube.blogspot.com/feeds/658782534455251811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://gerdas-stube.blogspot.com/2010/10/pig-operator-hadoop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7278761823670669478/posts/default/658782534455251811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7278761823670669478/posts/default/658782534455251811'/><link rel='alternate' type='text/html' href='http://gerdas-stube.blogspot.com/2010/10/pig-operator-hadoop.html' title='Pig Operator - Hadoop'/><author><name>News Updates</name><uri>http://www.blogger.com/profile/07043626217207239043</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>