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


Java PigStats.getAllStats方法代码示例

本文整理汇总了Java中org.apache.pig.tools.pigstats.PigStats.getAllStats方法的典型用法代码示例。如果您正苦于以下问题:Java PigStats.getAllStats方法的具体用法?Java PigStats.getAllStats怎么用?Java PigStats.getAllStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pig.tools.pigstats.PigStats的用法示例。


在下文中一共展示了PigStats.getAllStats方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pigRunnerTest

import org.apache.pig.tools.pigstats.PigStats; //导入方法依赖的package包/类
@Test
public void pigRunnerTest() throws Exception {
    String[] script = {
            "from org.apache.pig.scripting import *",
            "Pig.fs(\"rmr simple_out\")",
            "input = 'simple_table_2'",
            "output = 'simple_out'",
            "P = Pig.compile(\"\"\"a = load '$input';store a into '$output';\"\"\")",
            "Q = P.bind({'input':input, 'output':output})",
            "stats = Q.runSingle()",
            "if stats.isSuccessful():",
            "\tprint 'success!'",
            "else:",
            "\traise 'failed'"
    };
    String[] input = {
            "1\t3",
            "2\t4",
            "3\t5"
    };

    Util.createInputFile(cluster, "simple_table_2", input);

    PigStats mainStats = runPigRunner("pigRunnerTest", script);

    Map<String, List<PigStats>> statsMap = mainStats.getAllStats();
    assertEquals(1, statsMap.size());
    Iterator<List<PigStats>> it = statsMap.values().iterator();
    PigStats stats = it.next().get(0);
    assertTrue("job should succeed", stats.isSuccessful());
    assertEquals(1, stats.getNumberJobs());
    String name = stats.getOutputNames().get(0);
    assertEquals("simple_out", name);
    assertEquals(12, stats.getBytesWritten());
    assertEquals(3, stats.getRecordWritten());
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:37,代码来源:TestScriptLanguage.java

示例2: runParallelTest

import org.apache.pig.tools.pigstats.PigStats; //导入方法依赖的package包/类
@Test
public void runParallelTest() throws Exception {
    String[] script = {
            "#!/usr/bin/python",
            "from org.apache.pig.scripting import *",
            "input = 'simple_table_3'",
            "Pig.fs(\"rmr simple_out\")",
            "Pig.fs(\"rmr simple_out2\")",
            "output1 = 'simple_out'",
            "output2 = 'simple_out2'",
            "P = Pig.compile(\"mypipeline\", \"\"\"a = load '$input';store a into '$output';\"\"\")",
            "Q = P.bind([{'input':input, 'output':output1}, {'input':input, 'output':output2}])",
            "stats = Q.run()"
    };
    String[] input = {
            "1\t3",
            "2\t4",
            "3\t5"
    };

    Util.createInputFile(cluster, "simple_table_3", input);

    PigStats mainStats = runPigRunner("runParallelTest", script);

    Map<String, List<PigStats>> statsMap = mainStats.getAllStats();
    assertEquals(1, statsMap.size());
    assertEquals("mypipeline", statsMap.keySet().iterator().next());
    List<PigStats> lst = statsMap.get("mypipeline");
    assertEquals(2, lst.size());
    for (PigStats stats : lst) {
        assertTrue("job should succeed", stats.isSuccessful());
        assertEquals(1, stats.getNumberJobs());
        assertEquals(12, stats.getBytesWritten());
        assertEquals(3, stats.getRecordWritten());
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:37,代码来源:TestScriptLanguage.java

示例3: runLoopTest

import org.apache.pig.tools.pigstats.PigStats; //导入方法依赖的package包/类
@Test
public void runLoopTest() throws Exception {
    String[] script = {
            "#!/usr/bin/python",
            "from org.apache.pig.scripting import *",
            "Pig.fs(\"rmr simple_out\")",
            "Pig.fs(\"rmr simple_out2\")",
            "input = 'simple_table_4'",
            "P = Pig.compile(\"mypipeline\", \"\"\"a = load '$input';store a into '$output';\"\"\")",
            "for x in [\"simple_out\", \"simple_out2\"]:",
            "\tQ = P.bind({'input':input, 'output':x}).run()"
    };
    String[] input = {
            "1\t3",
            "2\t4",
            "3\t5"
    };

    Util.createInputFile(cluster, "simple_table_4", input);

    PigStats mainStats = runPigRunner("runLoopTest", script);

    Map<String, List<PigStats>> statsMap = mainStats.getAllStats();
    assertEquals(1, statsMap.size());
    assertEquals("mypipeline", statsMap.keySet().iterator().next());
    List<PigStats> lst = statsMap.get("mypipeline");
    assertEquals(2, lst.size());
    for (PigStats stats : lst) {
        assertTrue("job should succeed", stats.isSuccessful());
        assertEquals(1, stats.getNumberJobs());
        assertEquals(12, stats.getBytesWritten());
        assertEquals(3, stats.getRecordWritten());
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:35,代码来源:TestScriptLanguage.java

示例4: runParallelTest2

import org.apache.pig.tools.pigstats.PigStats; //导入方法依赖的package包/类
@Test
public void runParallelTest2() throws Exception {
    String[] script = {
            "#!/usr/bin/python",
            "from org.apache.pig.scripting import *",
            "input = 'simple_table_7'",
            "Pig.fs(\"rmr simple_out\")",
            "Pig.fs(\"rmr simple_out2\")",
            "output1 = 'simple_out'",
            "output2 = 'simple_out2'",
            "P = Pig.compile(\"mypipeline\", \"\"\"a = load '$input';",
            "b = foreach a generate $0, org.apache.pig.test.utils.UDFContextTestEvalFunc3($0);",
            "store b into '$output';\"\"\")",
            "Q = P.bind([{'input':input, 'output':output1}, {'input':input, 'output':output2}])",
            "stats = Q.run()"
    };
    String[] input = {
            "1\t3"
    };

    Util.createInputFile(cluster, "simple_table_7", input);
    PigStats mainStats = runPigRunner("runParallelTest2", script);

    Map<String, List<PigStats>> statsMap = mainStats.getAllStats();
    assertEquals(1, statsMap.size());
    assertEquals("mypipeline", statsMap.keySet().iterator().next());
    List<PigStats> lst = statsMap.get("mypipeline");
    assertEquals(2, lst.size());
    String[] results = new String[2];
    int i = 0;
    for (PigStats stats : lst) {
        assertTrue("job should succeed", stats.isSuccessful());
        assertEquals(1, stats.getNumberJobs());
        OutputStats os = stats.getOutputStats().get(0);
        Tuple t = os.iterator().next();
        results[i++] = t.get(1).toString();
    }
    assertTrue(results[0] != null);
    assertTrue(results[1] != null);
    assertTrue(!results[0].equals(results[1]));
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:42,代码来源:TestScriptLanguage.java


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