This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Introduction to gist | |
*/ | |
public class HelloGist{ | |
public static void sayHello(){ | |
System.out.println("Hello gist"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<repositories> | |
<repository> | |
<id>cloudera-releases</id> | |
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url> | |
<releases> | |
<enabled>true</enabled> | |
</releases> | |
<snapshots> | |
<enabled>false</enabled> | |
</snapshots> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.apache.hadoop</groupId> | |
<artifactId>hadoop-core</artifactId> | |
<version>0.20.2-cdh3u6</version> | |
</dependency> | |
<dependency> | |
<groupId>org.apache.pig</groupId> | |
<artifactId>pigunit</artifactId> | |
<version>0.10.0-cdh3u4</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = load 'src/main/resources/sample.data'; | |
B = foreach A generate flatten(TOKENIZE((chararray)$0)) as word; | |
C = group B by word; | |
D = foreach C generate COUNT(B), group; | |
dump D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Johny, Johny! | |
Yes, Papa | |
Eating sugar? | |
No, Papa | |
Telling lies? | |
No, Papa | |
Open your mouth! | |
Ha! Ha! Ha! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testStudentsPigScript() throws Exception { | |
PigTest pigTest = new PigTest("src/main/resources/wordcount.pig"); | |
pigTest.assertOutput("D", new String[] { "(2,No)", "(3,Ha!)", | |
"(1,Yes)", "(1,Open)", "(3,Papa)", "(1,your)", "(1,Johny)", | |
"(1,lies?)", "(1,Eating)", "(1,Johny!)", "(1,mouth!)", | |
"(1,sugar?)", "(1,Telling)", }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<NotepadPlus> | |
<UserLang name="Apache PIG" ext="pig" udlVersion="2.1"> | |
<Settings> | |
<Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" /> | |
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" /> | |
</Settings> | |
<KeywordLists> | |
<Keywords name="Comments">00-- 01 02 03/* 04*/</Keywords> | |
<Keywords name="Numbers, prefix1"></Keywords> | |
<Keywords name="Numbers, prefix2"></Keywords> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-bash-3.2$ echo -e "mark||2011\ntony|Mr.|2012\nrichard||2013" > input.txt | |
-bash-3.2$ cat input.txt | |
mark||2011 | |
tony|Mr.|2012 | |
richard||2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-bash-3.2$ hadoop fs -copyFromLocal input.txt /user/abhijit/input.txt | |
-bash-3.2$ hadoop fs -cat /user/abhijit/input.txt | |
mark||2011 | |
tony|Mr.|2012 | |
richard||2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTERNAL TABLE person | |
( | |
name string, | |
title string, | |
birth_year string | |
) | |
ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' | |
LOCATION '/person'; |
OlderNewer