当前位置: 首页>>代码示例>>Java>>正文


Java PigServer.getExamples方法代码示例

本文整理汇总了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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:18,代码来源:TestExampleGenerator.java

示例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);

}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:13,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:15,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:11,代码来源:TestExampleGenerator.java

示例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);

}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:12,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:10,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:13,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:13,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:14,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:12,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:13,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:13,代码来源:TestExampleGenerator.java

示例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);

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:11,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:14,代码来源:TestExampleGenerator.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:10,代码来源:TestExampleGenerator.java


注:本文中的org.apache.pig.PigServer.getExamples方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。