Package org.apache.pig.scripting

Examples of org.apache.pig.scripting.ScriptEngine


            String msg = "Can't read file: " + path;
            throw new FrontendException(msg, errCode,
                    PigException.USER_ENVIRONMENT);
        }
        if(scriptingLang != null) {
            ScriptEngine se = ScriptEngine.getInstance(scriptingLang);
            se.registerFunctions(path, namespace, pigContext);
        }
        pigContext.addScriptFile(path);
    }
View Full Code Here


            String msg = "Can't read file: " + path;
            throw new FrontendException(msg, errCode,
                    PigException.USER_ENVIRONMENT);
        }
        if(scriptingLang != null) {
            ScriptEngine se = ScriptEngine.getInstance(scriptingLang);
            se.registerFunctions(path, namespace, pigContext);
        }
        pigContext.addScriptFile(path);
    }
View Full Code Here

            String msg = "Can't read file: " + path;
            throw new FrontendException(msg, errCode,
                    PigException.USER_ENVIRONMENT);
        }
        if(scriptingLang != null) {
            ScriptEngine se = ScriptEngine.getInstance(scriptingLang);   
            se.registerFunctions(path, namespace, pigContext);
        }
        pigContext.addScriptFile(path);
    }
View Full Code Here

private static int runEmbeddedScript(PigContext pigContext, String file, String engine)
        throws IOException {
    log.info("Run embedded script: " + engine);
    pigContext.connect();
    ScriptEngine scriptEngine = ScriptEngine.getInstance(engine);
    Map<String, List<PigStats>> statsMap = scriptEngine.run(pigContext, file);
    PigStatsUtil.setStatsMap(statsMap);
   
    int failCount = 0;
    int totalCount = 0;
    for (List<PigStats> lst : statsMap.values()) {
View Full Code Here

        //Use the relative path in the jar, if the path specified is relative
        String nameInJar = filePath.equals(cwd + File.separator + path) ?
                filePath.substring(cwd.length() + 1) : filePath;
        pigContext.addScriptFile(nameInJar, filePath);
        if(scriptingLang != null) {
            ScriptEngine se = ScriptEngine.getInstance(scriptingLang);
            se.registerFunctions(nameInJar, namespace, pigContext);
        }
    }
View Full Code Here

        //Use the relative path in the jar, if the path specified is relative
        String nameInJar = filePath.equals(cwd + File.separator + path) ?
                filePath.substring(cwd.length() + 1) : filePath;
        pigContext.addScriptFile(nameInJar, filePath);
        if(scriptingLang != null) {
            ScriptEngine se = ScriptEngine.getInstance(scriptingLang);
            se.registerFunctions(nameInJar, namespace, pigContext);
        }
    }
View Full Code Here

    private static int runEmbeddedScript(PigContext pigContext, String file, String engine)
    throws IOException {
        log.info("Run embedded script: " + engine);
        pigContext.connect();
        ScriptEngine scriptEngine = ScriptEngine.getInstance(engine);
        Map<String, List<PigStats>> statsMap = scriptEngine.run(pigContext, file);
        PigStatsUtil.setStatsMap(statsMap);

        int failCount = 0;
        int totalCount = 0;
        for (List<PigStats> lst : statsMap.values()) {
View Full Code Here

        //Use the relative path in the jar, if the path specified is relative
        String nameInJar = filePath.equals(cwd + File.separator + path) ?
                filePath.substring(cwd.length() + 1) : filePath;
        pigContext.addScriptFile(nameInJar, filePath);
        if(scriptingLang != null) {
            ScriptEngine se = ScriptEngine.getInstance(scriptingLang);
            se.registerFunctions(nameInJar, namespace, pigContext);
        }
    }
View Full Code Here

    private static int runEmbeddedScript(PigContext pigContext, String file, String engine)
    throws IOException {
        log.info("Run embedded script: " + engine);
        pigContext.connect();
        ScriptEngine scriptEngine = ScriptEngine.getInstance(engine);
        Map<String, List<PigStats>> statsMap = scriptEngine.run(pigContext, file);
        PigStatsUtil.setStatsMap(statsMap);

        int failCount = 0;
        int totalCount = 0;
        for (List<PigStats> lst : statsMap.values()) {
View Full Code Here

    Util.deleteFile(pigServer.getPigContext(), "simple_table");
    Util.deleteFile(pigServer.getPigContext(), "simple_out");
    Util.createInputFile(pigServer.getPigContext(), "simple_table", input);
    Util.createLocalInputFile( "testScript.py", script);

    ScriptEngine scriptEngine = ScriptEngine.getInstance("jython");
    Map<String, List<PigStats>> statsMap = scriptEngine.run(pigServer.getPigContext(), "testScript.py");
    assertEquals(1, statsMap.size());
    Iterator<List<PigStats>> it = statsMap.values().iterator();
    PigStats stats = it.next().get(0);
    assertTrue(stats.isSuccessful());
View Full Code Here

TOP

Related Classes of org.apache.pig.scripting.ScriptEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.