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


Java ExecType.LOCAL属性代码示例

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


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

示例1: setup

private PigServer setup(String script, Configuration conf) throws Exception {
    if (conf == null) {
        conf = new HdfsConfiguration();
    }
    conf.setIfUnset(VespaConfiguration.DRYRUN, "true");
    conf.setIfUnset(VespaConfiguration.ENDPOINT, "dummy-endpoint");

    // Parameter substitutions - can also be set by configuration
    Map<String, String> parameters = new HashMap<>();
    parameters.put("ENDPOINT", "endpoint-does-not-matter-in-dryrun,another-endpoint-that-does-not-matter");

    PigServer ps = new PigServer(ExecType.LOCAL, conf);
    ps.setBatchOn();
    ps.registerScript(script, parameters);

    return ps;
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:17,代码来源:VespaStorageTest.java

示例2: createPig

protected PigServer createPig() throws ExecException {
    HdpBootstrap.hackHadoopStagingOnWin();

    Properties properties = HdpBootstrap.asProperties(QueryTestParams.provisionQueries(HdpBootstrap.hadoopConfig()));
    String pigHost = properties.getProperty("pig");
    // remote Pig instance
    if (StringUtils.hasText(pigHost) && !"local".equals(pig)) {
        LogFactory.getLog(PigWrapper.class).info("Executing Pig in Map/Reduce mode");
        return new PigServer(ExecType.MAPREDUCE, properties);
    }

    // use local instance
    LogFactory.getLog(PigWrapper.class).info("Executing Pig in local mode");
    properties.put("mapred.job.tracker", "local");
    return new PigServer(ExecType.LOCAL, properties);
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:16,代码来源:PigWrapper.java

示例3: setup

@Before
public void setup() throws IOException {
    pig = new PigServer(ExecType.LOCAL);

    Util.deleteDirectory(new File(dataDir));
    try {
        pig.mkdirs(dataDir);

        Util.createLocalInputFile(dataDir + scalarInput,
            new String[] {
                "{ \"i\": 1, \"l\": 10, \"f\": 2.718, \"d\": 3.1415, \"b\": \"17\", \"c\": \"aardvark\" }",
                "{ \"i\": 2, \"l\": 100, \"f\": 1.234, \"d\": 3.3333, \"b\": null, \"c\": \"17.0\" }"
        });

        Util.createLocalInputFile(dataDir + complexInput,
            new String[] {
                "{ \"tuple\": { \"a\": 1, \"b\": 2 }, \"nested_tuple\": { \"a\": 1, \"b\": { \"c\": 2, \"d\": 3 } }, \"bag\": [{ \"a\": 1, \"b\": 2 }, { \"a\": 3, \"b\": 4 }], \"nested_bag\": [{\"a\": 1, \"b\": [{ \"c\": 2, \"d\": 3 }, { \"c\": 4, \"d\": 5 }]}], \"map\": { \"a\": 1, \"b\": 2 }, \"nested_map\": { \"a\": { \"b\": 1, \"c\": 2 } } }",
                "{ \"tuple\": { \"a\": 3, \"b\": 4 }, \"nested_tuple\": { \"a\": 4, \"b\": { \"c\": 5, \"d\": 6 } }, \"bag\": [{ \"a\": 5, \"b\": 6 }, { \"a\": 7, \"b\": 8 }], \"nested_bag\": [{\"a\": 6, \"b\": [{ \"c\": 7, \"d\": 8 }, { \"c\": 9, \"d\": 0 }]}], \"map\": { \"a\": 3, \"b\": 4 }, \"nested_map\": { \"a\": { \"b\": 3, \"c\": 4 } } }"
        });

        Util.createLocalInputFile(dataDir + nestedArrayInput,
            new String[] {
                "{ \"arr\": [1, 2, 3, 4], \"nested_arr\": [[1, 2], [3, 4]], \"nested_arr_2\": [[1, 2], [3, 4]], \"very_nested_arr\": [[[1, 2], [3, 4]], [[5, 6], [7, 6]]], \"i\": 9 }"
        });
    } catch (IOException e) {};
}
 
开发者ID:mortardata,项目名称:pig-json,代码行数:26,代码来源:TestFromJsonInferSchema.java

示例4: testMockStoreAndLoad

@Test
public void testMockStoreAndLoad() throws Exception {
  PigServer pigServer = new PigServer(ExecType.LOCAL);
  Data data = resetData(pigServer);

  data.set("foo",
      tuple("a"),
      tuple("b"),
      tuple("c")
      );

  pigServer.registerQuery("A = LOAD 'foo' USING mock.Storage();");
  pigServer.registerQuery("STORE A INTO 'bar' USING mock.Storage();");

  List<Tuple> out = data.get("bar");
  assertEquals(tuple("a"), out.get(0));
  assertEquals(tuple("b"), out.get(1));
  assertEquals(tuple("c"), out.get(2));
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:19,代码来源:TestMockStorage.java

示例5: testSecondarySort

@Test
public void testSecondarySort() throws Exception {
    PigServer pigServer = new PigServer(ExecType.LOCAL);
    Data data = resetData(pigServer);

    data.set("foo",
        tuple("a", 1, "b"),
        tuple("b", 2, "c"),
        tuple("c", 3, "d")
        );

    pigServer.registerQuery("A = LOAD 'foo' USING mock.Storage() AS (f1:chararray,f2:int,f3:chararray);");
    pigServer.registerQuery("B = order A by f1,f2,f3 DESC;");
    pigServer.registerQuery("STORE B INTO 'bar' USING mock.Storage();");

    List<Tuple> out = data.get("bar");
    assertEquals(tuple("a", 1, "b"), out.get(0));
    assertEquals(tuple("b", 2, "c"), out.get(1));
    assertEquals(tuple("c", 3, "d"), out.get(2));
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:20,代码来源:TestPigServer.java

示例6: testMissingCols2

@Test
public void testMissingCols2() throws Exception {
    String inputFileName = "TestProject-testMissingCols2-input.txt";
    String input[] = { "1\t(hello,world)", "2\t(good,bye)" };
    Util.createLocalInputFile(inputFileName, input);
    // in the script, PigStorage will return a null for the tuple field
    // since it does not comply with the schema
    String query = "a = load '" + inputFileName + "' as (i:int, " +
            "t:tuple(s1:chararray, s2:chararray, s3:chararray));" +
            "b = foreach a generate t.(s2,s3);";

    PigServer ps = new PigServer(ExecType.LOCAL);
    Util.registerMultiLineQuery(ps, query);
    Iterator<Tuple> it = ps.openIterator("b");
    Tuple[] expectedResults = new Tuple[] {
                    (Tuple)Util.getPigConstant("((null, null))"),
                    (Tuple)Util.getPigConstant("((null, null))")
    };
    int i = 0;
    while (it.hasNext()) {
        assertEquals(expectedResults[i++], it.next());
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:23,代码来源:TestProject.java

示例7: testScriptMissingLastNewLine

@Test
public void testScriptMissingLastNewLine() throws Throwable {
    PigServer server = new PigServer(ExecType.LOCAL);
    PigContext context = server.getPigContext();

    String strCmd = "A = load 'bar';\nB = foreach A generate $0;";

    BufferedReader reader = new BufferedReader(new StringReader(strCmd));
    String substituted = context.doParamSubstitution(reader, null, null);
    BufferedReader pigInput = new BufferedReader(new StringReader(substituted));

    Grunt grunt = new Grunt(pigInput, context);
    int results[] = grunt.exec();
    for (int i=0; i<results.length; i++) {
        assertEquals(0, results[i]);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:17,代码来源:TestGrunt.java

示例8: testIllustrateScript4

@Test
public void testIllustrateScript4() throws Throwable {
    // empty line/field test
    PigServer server = new PigServer(ExecType.LOCAL, new Properties());
    PigContext context = server.getPigContext();
    
    String strCmd = "illustrate -script "
            + basedir + "/illustrate4.pig;";
    
    ByteArrayInputStream cmd = new ByteArrayInputStream(strCmd.getBytes());
    InputStreamReader reader = new InputStreamReader(cmd);
    
    Grunt grunt = new Grunt(new BufferedReader(reader), context);

    grunt.exec();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:16,代码来源:TestGrunt.java

示例9: testParseUserAgentPigUDF_allFields

@Test
public void testParseUserAgentPigUDF_allFields() throws Exception {
    PigServer pigServer = new PigServer(ExecType.LOCAL);
    Storage.Data storageData = resetData(pigServer);

    storageData.set("agents", "agent:chararray", tuple(testUserAgent));

    pigServer.registerQuery("define ParseUserAgent nl.basjes.parse.useragent.pig.ParseUserAgent();");
    pigServer.registerQuery("A = LOAD 'agents' USING mock.Storage();");
    pigServer.registerQuery("B = FOREACH A GENERATE ParseUserAgent(agent);");
    pigServer.registerQuery("STORE B INTO 'parsedAgents' USING mock.Storage();");
    verifyStorageData(storageData);
}
 
开发者ID:nielsbasjes,项目名称:yauaa,代码行数:13,代码来源:TestParseUserAgent.java

示例10: testParseUserAgentPigUDF_Cache_allFields

@Test
public void testParseUserAgentPigUDF_Cache_allFields() throws Exception {
    PigServer pigServer = new PigServer(ExecType.LOCAL);
    Storage.Data storageData = resetData(pigServer);

    storageData.set("agents", "agent:chararray", tuple(testUserAgent));

    pigServer.registerQuery("define ParseUserAgent nl.basjes.parse.useragent.pig.ParseUserAgent('5');");
    pigServer.registerQuery("A = LOAD 'agents' USING mock.Storage();");
    pigServer.registerQuery("B = FOREACH A GENERATE ParseUserAgent(agent);");
    pigServer.registerQuery("STORE B INTO 'parsedAgents' USING mock.Storage();");
    verifyStorageData(storageData);
}
 
开发者ID:nielsbasjes,项目名称:yauaa,代码行数:13,代码来源:TestParseUserAgent.java

示例11: setup

private PigServer setup(String script, String endpoint) throws Exception {
    Configuration conf = new HdfsConfiguration();
    Map<String, String> parameters = new HashMap<>();
    parameters.put("ENDPOINT", endpoint);

    PigServer ps = new PigServer(ExecType.LOCAL, conf);
    ps.setBatchOn();
    ps.registerScript(script, parameters);

    return ps;
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:11,代码来源:VespaQueryTest.java

示例12: setup

@Before
public void setup() throws IOException {
    pig = new PigServer(ExecType.LOCAL);

    Util.deleteDirectory(new File(dataDir));
    try {
        pig.mkdirs(dataDir);

        Util.createLocalInputFile(dataDir + scalarInput,
            new String[] {
                "{ \"i\": 1, \"l\": 10, \"f\": 2.718, \"d\": 3.1415, \"b\": \"17\", \"c\": \"aardvark\" }",
                "{ \"i\": 2, \"l\": 100, \"f\": 1.234, \"d\": 3.3333, \"b\": null, \"c\": \"17.0\" }"
        });

        Util.createLocalInputFile(dataDir + complexInput,
            new String[] {
                "{ \"tuple\": { \"a\": 1, \"b\": 2 }, \"nested_tuple\": { \"a\": 1, \"b\": { \"c\": 2, \"d\": 3 } }, \"bag\": [{ \"a\": 1, \"b\": 2 }, { \"a\": 3, \"b\": 4 }], \"nested_bag\": [{\"a\": 1, \"b\": [{ \"c\": 2, \"d\": 3 }, { \"c\": 4, \"d\": 5 }]}], \"map\": { \"a\": 1, \"b\": 2 }, \"nested_map\": { \"a\": { \"b\": 1, \"c\": 2 } } }",
                "{ \"tuple\": { \"a\": 3, \"b\": 4 }, \"nested_tuple\": { \"a\": 4, \"b\": { \"c\": 5, \"d\": 6 } }, \"bag\": [{ \"a\": 5, \"b\": 6 }, { \"a\": 7, \"b\": 8 }], \"nested_bag\": [{\"a\": 6, \"b\": [{ \"c\": 7, \"d\": 8 }, { \"c\": 9, \"d\": 0 }]}], \"map\": { \"a\": 3, \"b\": 4 }, \"nested_map\": { \"a\": { \"b\": 3, \"c\": 4 } } }"
        });

        Util.createLocalInputFile(dataDir + nestedArrayInput,
            new String[] {
                "{ \"arr\": [1, 2, 3, 4], \"nested_arr\": [[1, 2], [3, 4]], \"nested_arr_2\": [[1, 2], [3, 4]], \"very_nested_arr\": [[[1, 2], [3, 4]], [[5, 6], [7, 6]]], \"i\": 9 }"
        });

        Util.createLocalInputFile(dataDir + unusualFieldNameInput,
            new String[] {
                "{\"f_1\": 1, \"__f2\": 2, \"f 3\": 3}",
                "{\"f_1\": 4, \"__f2\": 5, \"f 3\": 6}"
        });
    } catch (IOException e) {};
}
 
开发者ID:mortardata,项目名称:pig-json,代码行数:32,代码来源:TestFromJsonWithSchema.java

示例13: setup

@Before
public void setup() throws IOException {
    pig = new PigServer(ExecType.LOCAL);

    Util.deleteDirectory(new File(dataDir));
    try {
        pig.mkdirs(dataDir);

        Util.createLocalInputFile(dataDir + scalarInput,
            new String[] {
                "{ \"i\": 1, \"l\": 10, \"f\": 2.718, \"d\": 3.1415, \"b\": \"17\", \"c\": \"aardvark\", \"bl\": true}",
                "{ \"i\": 2, \"l\": 100, \"f\": 1.234, \"d\": 3.3333, \"b\": null, \"c\": \"17.0\", \"bl\": false }"
        });

        Util.createLocalInputFile(dataDir + complexInput,
            new String[] {
                "{ \"tuple\": { \"a\": 1, \"b\": 2 }, \"nested_tuple\": { \"a\": 1, \"b\": { \"c\": 2, \"d\": 3 } }, \"bag\": [{ \"a\": 1, \"b\": 2 }, { \"a\": 3, \"b\": 4 }], \"nested_bag\": [{\"a\": 1, \"b\": [{ \"c\": 2, \"d\": 3 }, { \"c\": 4, \"d\": 5 }]}], \"map\": { \"a\": 1, \"b\": 2 }, \"nested_map\": { \"a\": { \"b\": 1, \"c\": 2 } } }",
                "{ \"tuple\": { \"a\": 3, \"b\": 4 }, \"nested_tuple\": { \"a\": 4, \"b\": { \"c\": 5, \"d\": 6 } }, \"bag\": [{ \"a\": 5, \"b\": 6 }, { \"a\": 7, \"b\": 8 }], \"nested_bag\": [{\"a\": 6, \"b\": [{ \"c\": 7, \"d\": 8 }, { \"c\": 9, \"d\": 0 }]}], \"map\": { \"a\": 3, \"b\": 4 }, \"nested_map\": { \"a\": { \"b\": 3, \"c\": 4 } } }"
        });

        Util.createLocalInputFile(dataDir + nestedArrayInput,
            new String[] {
                "{ \"arr\": [1, 2, 3, 4], \"nested_arr\": [[1, 2], [3, 4]], \"nested_arr_2\": [[1, 2], [3, 4]], \"very_nested_arr\": [[[1, 2], [3, 4]], [[5, 6], [7, 6]]], \"i\": 9 }"
        });

        Util.createLocalInputFile(dataDir + unusualFieldNameInput,
            new String[] {
                "{\"f_1\": 1, \"__f2\": 2, \"f 3\": 3}",
                "{\"f_1\": 4, \"__f2\": 5, \"f 3\": 6}"
        });

        Util.createLocalInputFile(dataDir + nullMapBagTuple, 
            new String[] {
                "{ \"map\":null, \"bag\":null, \"tup\":null }"
        });
    } catch (IOException e) {};
}
 
开发者ID:mortardata,项目名称:pig-json,代码行数:37,代码来源:TestJsonLoader.java

示例14: createPigTest

public static PigTest createPigTest(String scriptFile, String[] args) throws PigException {
    try {
        PigServer pigServer = new PigServer(ExecType.LOCAL);
        Cluster pigCluster = new Cluster(pigServer.getPigContext());
        return new PigTest(scriptFile, args, pigServer, pigCluster);
    } catch (Exception ex) {
        throw new PigException("Failed to create PigTest instance. ", ex);
    }
}
 
开发者ID:christiangda,项目名称:pigiptools,代码行数:9,代码来源:PigUnitUtil.java

示例15: setUpBeforeClass

@BeforeClass
public static void setUpBeforeClass() throws Exception {
  // Setup log4j for testing.
  org.apache.log4j.BasicConfigurator.configure();
  Properties properties = new Properties();
  properties.setProperty("hive.metastore.uris", "thrift://localhost:9083");
  server = new PigServer(ExecType.LOCAL, properties);
}
 
开发者ID:cloudera,项目名称:RecordServiceClient,代码行数:8,代码来源:TestBase.java


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