本文整理汇总了Java中org.apache.pig.PigServer.getExamples方法的典型用法代码示例。如果您正苦于以下问题:Java PigServer.getExamples方法的具体用法?Java PigServer.getExamples怎么用?Java PigServer.getExamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.PigServer
的用法示例。
在下文中一共展示了PigServer.getExamples方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFilterGroupCountStore
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testFilterGroupCountStore() throws Exception {
File out = File.createTempFile("testFilterGroupCountStoreOutput", "");
out.deleteOnExit();
out.delete();
PigServer pigServer = new PigServer(pigContext);
pigServer.setBatchOn();
pigServer.registerQuery("A = load " + A.toString() + " as (x, y);");
pigServer.registerQuery("B = filter A by x < 5;");
pigServer.registerQuery("C = group B by x;");
pigServer.registerQuery("D = foreach C generate group as x, COUNT(B) as the_count;");
pigServer.registerQuery("store D into '" + Util.encodeEscape(out.getAbsolutePath()) + "';");
Map<Operator, DataBag> derivedData = pigServer.getExamples(null);
assertNotNull(derivedData);
}
示例2: testGroup3
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testGroup3() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A.toString() + " as (x:int, y:int);");
pigServer.registerQuery("B = FILTER A by x > 3;");
pigServer.registerQuery("C = group B by y;");
pigServer.registerQuery("D = foreach C generate group, COUNT(B);");
Map<Operator, DataBag> derivedData = pigServer.getExamples("D");
assertNotNull(derivedData);
}
示例3: testFilter2
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testFilter2() throws Exception {
PigServer pigserver = new PigServer(pigContext);
String query = "A = load " + A
+ " using PigStorage() as (x : int, y : int);\n";
pigserver.registerQuery(query);
query = "B = filter A by x > 5 AND y < 6;";
pigserver.registerQuery(query);
Map<Operator, DataBag> derivedData = pigserver.getExamples("B");
assertNotNull(derivedData);
}
示例4: testUnion
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testUnion() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A.toString() + " as (x, y);");
pigServer.registerQuery("B = load " + B.toString() + " as (x, y);");
pigServer.registerQuery("C = union A, B;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("C");
assertNotNull(derivedData);
}
示例5: testForEachNestedBlock2
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testForEachNestedBlock2() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A.toString() + " as (x:int, y:int);");
pigServer.registerQuery("B = group A by x;");
pigServer.registerQuery("C = foreach B { FA = filter A by y == 6; DA = DISTINCT FA; generate group, COUNT(DA);};");
Map<Operator, DataBag> derivedData = pigServer.getExamples("C");
assertNotNull(derivedData);
}
示例6: testLimit
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testLimit() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A.toString() + " as (x, y);");
pigServer.registerQuery("B = limit A 5;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}
示例7: testForeach
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testForeach() throws ExecException, IOException {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A
+ " using PigStorage() as (x : int, y : int);");
pigServer.registerQuery("B = foreach A generate x + y as sum;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}
示例8: testForeachBinCondWithBooleanExp
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testForeachBinCondWithBooleanExp() throws ExecException, IOException {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A
+ " using PigStorage() as (x : int, y : int);");
pigServer.registerQuery("B = foreach A generate (x + 1 > y ? 0 : 1);");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}
示例9: testForeachWithTypeCastCounter
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testForeachWithTypeCastCounter() throws ExecException, IOException {
PigServer pigServer = new PigServer(pigContext);
//cast error results in counter being incremented and was resulting
// in a NPE exception in illustrate
pigServer.registerQuery("A = load " + A
+ " using PigStorage() as (x : int, y : int);");
pigServer.registerQuery("B = foreach A generate x, (int)'InvalidInt';");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}
示例10: testCogroupMultipleCols
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testCogroupMultipleCols() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A + " as (x, y);");
pigServer.registerQuery("B = load " + B + " as (x, y);");
pigServer.registerQuery("C = cogroup A by (x, y), B by (x, y);");
Map<Operator, DataBag> derivedData = pigServer.getExamples("C");
assertNotNull(derivedData);
}
示例11: testJoin2
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testJoin2() throws IOException, ExecException {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A1 = load " + A + " as (x, y);");
pigServer.registerQuery("B1 = load " + A + " as (x, y);");
pigServer.registerQuery("E = join A1 by x, B1 by x;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("E");
assertNotNull(derivedData);
}
示例12: testFilterWithIsNull
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testFilterWithIsNull() throws ExecException, IOException {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A
+ " using PigStorage() as (x : int, y : int);");
pigServer.registerQuery("B = filter A by x is not null;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}
示例13: testGroup
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testGroup() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A.toString() + " as (x, y);");
pigServer.registerQuery("B = group A by x;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}
示例14: testFilterWithUDF
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testFilterWithUDF() throws ExecException, IOException {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A
+ " using PigStorage() as (x : int, y : int);");
pigServer.registerQuery("B = group A by x;");
pigServer.registerQuery("C = filter B by NOT IsEmpty(A.y);");
Map<Operator, DataBag> derivedData = pigServer.getExamples("C");
assertNotNull(derivedData);
}
示例15: testDistinct
import org.apache.pig.PigServer; //导入方法依赖的package包/类
@Test
public void testDistinct() throws Exception {
PigServer pigServer = new PigServer(pigContext);
pigServer.registerQuery("A = load " + A.toString() + " as (x, y);");
pigServer.registerQuery("B = DISTINCT A;");
Map<Operator, DataBag> derivedData = pigServer.getExamples("B");
assertNotNull(derivedData);
}