Package org.apache.pig.impl.logicalLayer.optimizer

Examples of org.apache.pig.impl.logicalLayer.optimizer.TypeCastInserter


        rulePlan = new RulePlan();
        RuleOperator loLoad = new RuleOperator(LOLoad.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loLoad);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOLoad.class.getName()), "LoadTypeCastInserter"));

        // Add type casting to plans where the schema has been declared by
        // user in a statement with stream operator.
        rulePlan = new RulePlan();
        RuleOperator loStream= new RuleOperator(LOStream.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loStream);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan, new TypeCastInserter(plan,
                LOStream.class.getName()), "StreamTypeCastInserter"));
       
        // Add type casting to plans where the schema has been declared by
        // user in a statement with native operator.
        rulePlan = new RulePlan();
        RuleOperator loNative= new RuleOperator(LONative.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loNative);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan, new TypeCastInserter(plan,
                LONative.class.getName()), "NativeTypeCastInserter"));
       
        // Push up filters as far as we can
        rulePlan = new RulePlan();
        RuleOperator loFilter = new RuleOperator(LOFilter.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loFilter);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOFilter.class.getName()),
                "PushUpFilter"));

    }
View Full Code Here


   
    @Test
    //Test to ensure that the right exception is thrown
    public void testErrTypeCastInserter() throws Exception {
        LogicalPlan lp = new LogicalPlan();
        TypeCastInserter tci = new TypeCastInserter(lp, "hello");
        try {
            tci.transform(lp.getRoots());
        } catch(Exception e) {
            assertTrue(((OptimizerException)e).getErrorCode() == 2052);
        }
    }
View Full Code Here

   
    @Test
    //Test to ensure that the right exception is thrown
    public void testErrTypeCastInserter() throws Exception {
        LogicalPlan lp = new LogicalPlan();
        TypeCastInserter tci = new TypeCastInserter(lp, "hello");
        try {
            tci.transform(lp.getRoots());
        } catch(Exception e) {
            assertTrue(((OptimizerException)e).getErrorCode() == 2052);
        }
    }
View Full Code Here

        rulePlan = new RulePlan();
        RuleOperator loLoad = new RuleOperator(LOLoad.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loLoad);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOLoad.class.getName()), "LoadTypeCastInserter"));

        // Add type casting to plans where the schema has been declared by
        // user in a statement with stream operator.
        rulePlan = new RulePlan();
        RuleOperator loStream= new RuleOperator(LOStream.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loStream);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan, new TypeCastInserter(plan,
                LOStream.class.getName()), "StreamTypeCastInserter"));
       
        // Push up filters as far as we can
        rulePlan = new RulePlan();
        RuleOperator loFilter = new RuleOperator(LOFilter.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loFilter);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOFilter.class.getName()),
                "PushUpFilter"));

    }
View Full Code Here

        rulePlan = new RulePlan();
        RuleOperator loLoad = new RuleOperator(LOLoad.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loLoad);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOLoad.class.getName()), "LoadTypeCastInserter"));

        // Add type casting to plans where the schema has been declared by
        // user in a statement with stream operator.
        rulePlan = new RulePlan();
        RuleOperator loStream= new RuleOperator(LOStream.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loStream);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan, new TypeCastInserter(plan,
                LOStream.class.getName()), "StreamTypeCastInserter"));
       
        // Push up filters as far as we can
        rulePlan = new RulePlan();
        RuleOperator loFilter = new RuleOperator(LOFilter.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loFilter);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOFilter.class.getName()),
                "PushUpFilter"));

    }
View Full Code Here

        nodes.add(LOLOAD_CLASSNAME);
        edges = new HashMap<Integer, Integer>();
        required = new ArrayList<Boolean>(1);
        required.add(true);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(nodes, edges,
                required, new TypeCastInserter(plan, LOLOAD_CLASSNAME)));

        // Add type casting to plans where the schema has been declared by
        // user in a statement with stream operator.
        nodes = new ArrayList<String>(1);
        nodes.add(LOSTREAM_CLASSNAME);
        edges = new HashMap<Integer, Integer>();
        required = new ArrayList<Boolean>(1);
        required.add(true);
        mRules.add(new Rule(nodes, edges, required, new TypeCastInserter(plan,
                LOSTREAM_CLASSNAME)));

    }
View Full Code Here

        rulePlan = new RulePlan();
        RuleOperator loLoad = new RuleOperator(LOLoad.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loLoad);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan,
                new TypeCastInserter(plan, LOLoad.class.getName()), "LoadTypeCastInserter"));

        // Add type casting to plans where the schema has been declared by
        // user in a statement with stream operator.
        rulePlan = new RulePlan();
        RuleOperator loStream= new RuleOperator(LOStream.class,
                new OperatorKey(SCOPE, nodeIdGen.getNextNodeId(SCOPE)));
        rulePlan.add(loStream);
        mRules.add(new Rule<LogicalOperator, LogicalPlan>(rulePlan, new TypeCastInserter(plan,
                LOStream.class.getName()), "StreamTypeCastInserter"));

    }
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.logicalLayer.optimizer.TypeCastInserter

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.