Package org.apache.pig.newplan.logical.expression

Examples of org.apache.pig.newplan.logical.expression.LogicalExpression


                            ProjectExpression projExpr = (ProjectExpression)o;
                            projExpr.setAttachedRelationalOp( op );
                        }
                    }
                }
                LogicalExpression root = (LogicalExpression)planCopy.getSources().get( 0 );// get the root of the plan
                LogicalFieldSchema schema;
                try {
                    schema = root.getFieldSchema();
                    if (schema.alias == null) {
                        schema.alias = colAlias;
                    }
                } catch (FrontendException e) {
                    // Sometimes it can throw an exception. If it does, then there is no schema to get
View Full Code Here


        }

    }

    LogicalExpression buildInvokerUDF(SourceLocation loc, LogicalExpressionPlan plan, String packageName, String funcName, boolean isStatic, List<LogicalExpression> args) throws RecognitionException {
        LogicalExpression le = new UserFuncExpression(plan, new FuncSpec(InvokerGenerator.class.getName()), args, false, true, isStatic, packageName, funcName);
        le.setLocation(loc);
        return le;
    }
View Full Code Here

        } catch (Exception e) {
            throw new PlanGenerationFailureException(intStream, loc, e);
        }

        FuncSpec funcSpec = pigContext.getFuncSpecFromAlias(funcName);
        LogicalExpression le;
        if( funcSpec == null ) {
            funcName = func.getName();
            funcSpec = new FuncSpec(funcName);
            //this point is only reached if there was no DEFINE statement for funcName
            //in which case, we pass that information along
            le = new UserFuncExpression(plan, funcSpec, args, false);
        } else {
            le = new UserFuncExpression(plan, funcSpec, args, true);
        }

        le.setLocation(loc);
        return le;
    }
View Full Code Here

       
        // build an expression with no AND
        LogicalExpressionPlan p3 = new LogicalExpressionPlan();
        LogicalRelationalOperator f1 = new LOFilter(plan, p3);
       
        LogicalExpression lp3 = new ProjectExpression(p3, 0, 2, f1);
        LogicalExpression cont = new ConstantExpression(p3, new Integer(3));
        p3.add(lp3);
        p3.add(cont);      
        LogicalExpression eq = new EqualExpression(p3, lp3, cont);       
       
       
        f1.setAlias("D");
        plan.add(f1);
       
View Full Code Here

    @Test
    public void testFilterRuleWithAnd() throws Exception  {
        prep();
       
        LogicalExpressionPlan p4 = new LogicalExpressionPlan();       
        LogicalExpression lp3 = new ProjectExpression(p4, 0, 2, filter);
        LogicalExpression cont = new ConstantExpression(p4, new Integer(3));
        p4.add(lp3);
        p4.add(cont);
        LogicalExpression eq = new EqualExpression(p4, lp3, cont);
     
        LogicalExpression lp4 = new ProjectExpression(p4, 0, 5, filter);
        LogicalExpression cont2 = new ConstantExpression(p4, new Float(100));
        p4.add(lp4);
        p4.add(cont2);
        LogicalExpression eq2 = new EqualExpression(p4, lp4, cont2);       
   
        LogicalExpression and = new AndExpression(p4, eq, eq2);       
       
        ((LOFilter)filter).setFilterPlan(p4);
       
        // run split filter rule
        Rule r = new SplitFilter("SplitFilter");
View Full Code Here

        prep();
        // build an expression with 2 AND, it should split into 3 filters
        LogicalExpressionPlan p5 = new LogicalExpressionPlan();
       
      
        LogicalExpression lp3 = new ProjectExpression(p5, 0, 2, filter);
        LogicalExpression cont = new ConstantExpression(p5, new Integer(3));
        p5.add(lp3);
        p5.add(cont);      
        LogicalExpression eq = new EqualExpression(p5, lp3, cont);
       
        LogicalExpression lp4 = new ProjectExpression(p5, 0, 3, filter);
        LogicalExpression cont2 = new ConstantExpression(p5, new Integer(3));       
        p5.add(lp4);
        p5.add(cont2);
        LogicalExpression eq2 = new EqualExpression(p5, lp4, cont2);       
       
        LogicalExpression and1 = new AndExpression(p5, eq, eq2);
      
        lp3 = new ProjectExpression(p5, 0, 0, filter);
        lp4 = new ProjectExpression(p5, 0, 3, filter);
        p5.add(lp3);
        p5.add(lp4);  
        eq2 = new EqualExpression(p5, lp3, lp4);       
             
        LogicalExpression and2 = new AndExpression(p5, and1, eq2);       
       
        ((LOFilter)filter).setFilterPlan(p5);
       
        Rule r = new SplitFilter("SplitFilter");
        Set<Rule> s = new HashSet<Rule>();
View Full Code Here

    public void testFilterRuleWith2And2() throws Exception  {
        prep();
        // build an expression with 2 AND, it should split into 3 filters
        LogicalExpressionPlan p5 = new LogicalExpressionPlan();
       
        LogicalExpression lp3 = new ProjectExpression(p5, 0, 2, filter);
        LogicalExpression cont = new ConstantExpression(p5, new Integer(3));
        p5.add(lp3);
        p5.add(cont);
        LogicalExpression eq = new EqualExpression(p5, lp3, cont);     
       
        lp3 = new ProjectExpression(p5, 0, 0, filter);
        LogicalExpression lp4 = new ProjectExpression(p5, 0, 3, filter);       
        p5.add(lp4);
        p5.add(lp3);
        LogicalExpression eq2 = new EqualExpression(p5, lp3, lp4);
       
        LogicalExpression and1 = new AndExpression(p5, eq, eq2);
       
        lp3 = new ProjectExpression(p5, 0, 2, filter);
        lp4 = new ProjectExpression(p5, 0, 5, filter);
        p5.add(lp3);
        p5.add(lp4);
        eq2 = new EqualExpression(p5, lp3, lp4);
       
        LogicalExpression and2 = new AndExpression(p5, and1, eq2);   
       
        ((LOFilter)filter).setFilterPlan(p5);
       
        Rule r = new SplitFilter("SplitFilter");
        Set<Rule> s = new HashSet<Rule>();
View Full Code Here

        this.pushdownExprPlan = new LogicalExpressionPlan();
    }

    public void visit() throws FrontendException {
        // we will visit the leaf and it will recursively walk the plan
        LogicalExpression leaf = (LogicalExpression)originalPlan.getSources().get( 0 );
        // if the leaf is a unary operator it should be a FilterFunc in
        // which case we don't try to extract partition filter conditions
        if(leaf instanceof BinaryExpression) {
            // recursively traverse the tree bottom up
            // checkPushdown returns KeyState which is pair of LogicalExpression
View Full Code Here

        }
    }

    private LogicalExpression addToFilterPlan(LogicalExpression op) throws FrontendException {
        // This copies the whole tree underneath op
        LogicalExpression newOp = op.deepCopy(filteredPlan);
        return newOp;
    }
View Full Code Here

            return b;
        }
        if (b == null) {
            return a;
        }
        LogicalExpression andOp = new AndExpression(plan, a, b);
        return andOp;
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.logical.expression.LogicalExpression

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.