Package org.apache.pig.backend.hadoop.executionengine.physicalLayer.util

Examples of org.apache.pig.backend.hadoop.executionengine.physicalLayer.util.MonitoredUDFExecutor


    }

    private void instantiateFunc(FuncSpec fSpec) {
        this.func = (EvalFunc) PigContext.instantiateFuncFromSpec(fSpec);
        if (func.getClass().isAnnotationPresent(MonitoredUDF.class)) {
            executor = new MonitoredUDFExecutor(func);
        }
        //the next couple of initializations do not work as intended for the following reasons
        //the reporter and pigLogger are member variables of PhysicalOperator
        //when instanitateFunc is invoked at deserialization time, both
        //reporter and pigLogger are null. They are set during map and reduce calls,
View Full Code Here


    @Test
    public void testTimeout() throws IOException {

        SimpleUDF udf = new SimpleUDF(1000);
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(udf);
        assertNull(exec.monitorExec(null));
    }
View Full Code Here

    @Test
    public void testTimeoutWithDefault() throws IOException {

        SimpleIntUDF udf = new SimpleIntUDF();
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(udf);
        assertEquals( SimpleIntUDF.DEFAULT, ((Integer) exec.monitorExec(null)).intValue());
    }
View Full Code Here

    @Test
    public void testCustomErrorHandler() throws IOException {

        ErrorCallbackUDF udf = new ErrorCallbackUDF();
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(udf);
        exec.monitorExec(null);
        assertTrue(thereWasATimeout);
    }
View Full Code Here

    }

    @Test
    public void testNoTimeout() throws IOException {
        SimpleUDF udf = new SimpleUDF(100);
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(udf);
        assertTrue((Boolean) exec.monitorExec(null));
    }
View Full Code Here

        long startTime = System.currentTimeMillis();
        long unmonitoredTime = 0, monitoredTime = 0;
       
        int[] numReps = { 1000, 10000, 100000, 1000000};
        MonitoredNoOpUDF monitoredUdf  = new MonitoredNoOpUDF();
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(monitoredUdf);
        UnmonitoredNoOpUDF unmonitoredUdf = new UnmonitoredNoOpUDF();
        // warm up
        System.out.println("Warming up.");
        for (int i : numReps) {
            for (int j=0; j < i; j++) {
                exec.monitorExec(null);
                unmonitoredUdf.exec(null);
            }
        }
        System.out.println("Warmed up. Timing.");
        // tests!
        for (int k = 0; k < 5; k++) {
            for (int i : numReps) {
                startTime = System.currentTimeMillis();
                for (int j = 0; j < i; j++) {
                    exec.monitorExec(null);
                }
                monitoredTime = System.currentTimeMillis() - startTime;
                startTime = System.currentTimeMillis();
                for (int j = 0; j < i; j++) {
                    unmonitoredUdf.exec(null);
View Full Code Here

    }

    private void instantiateFunc(FuncSpec fSpec) {
        this.func = (EvalFunc) PigContext.instantiateFuncFromSpec(fSpec);
        if (func.getClass().isAnnotationPresent(MonitoredUDF.class)) {
            executor = new MonitoredUDFExecutor(func);
        }
        //the next couple of initializations do not work as intended for the following reasons
        //the reporter and pigLogger are member variables of PhysicalOperator
        //when instanitateFunc is invoked at deserialization time, both
        //reporter and pigLogger are null. They are set during map and reduce calls,
View Full Code Here

    private void instantiateFunc(FuncSpec fSpec) {
        this.func = (EvalFunc) PigContext.instantiateFuncFromSpec(fSpec);
        this.setSignature(signature);
        this.setFuncInputSchema(signature);
        if (func.getClass().isAnnotationPresent(MonitoredUDF.class)) {
            executor = new MonitoredUDFExecutor(func);
        }
        //the next couple of initializations do not work as intended for the following reasons
        //the reporter and pigLogger are member variables of PhysicalOperator
        //when instanitateFunc is invoked at deserialization time, both
        //reporter and pigLogger are null. They are set during map and reduce calls,
View Full Code Here

    @Test
    public void testTimeout() throws IOException {

        SimpleUDF udf = new SimpleUDF(1000);
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(udf);
        assertNull(exec.monitorExec(null));
    }
View Full Code Here

    @Test
    public void testTimeoutWithDefault() throws IOException {

        SimpleIntUDF udf = new SimpleIntUDF();
        MonitoredUDFExecutor exec = new MonitoredUDFExecutor(udf);
        assertEquals( SimpleIntUDF.DEFAULT, ((Integer) exec.monitorExec(null)).intValue());
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.backend.hadoop.executionengine.physicalLayer.util.MonitoredUDFExecutor

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.