Package org.apache.pig.experimental.logical.relational

Examples of org.apache.pig.experimental.logical.relational.LogicalRelationalOperator


        preds = currentOp.getPlan().getPredecessors(currentOp);
        if (preds == null || input >= preds.size()) {
            throw new IOException("Projection with nothing to reference!");
        }
           
        LogicalRelationalOperator pred =
            (LogicalRelationalOperator)preds.get(input);
        if (pred == null) {
            throw new IOException("Found bad operator in logical plan");
        }
        return pred;
View Full Code Here


                         collectUids(gen, exp, input);                        
                         found = true;
                       
                     } else if (op instanceof ProjectExpression && ((ProjectExpression)op).isProjectStar()) {
                         int inputNum = ((ProjectExpression)op).getInputNum();                             
                         LogicalRelationalOperator pred = (LogicalRelationalOperator)gen.getPlan().getPredecessors(gen).get(inputNum);
                        
                         if (pred.getSchema() == null) {
                             throw new SchemaNotDefinedException("Schema for " + pred.getName() + " is not defined.");
                         }
                         for(LogicalFieldSchema f: pred.getSchema().getFields()) {
                             if (f.uid == uid) {
                                 input.add(uid);
                                 found = true;
                             }
                         }
                        
                     } else if (gen.getFlattenFlags()[i]) {
                         // if uid equal to the expression, get all uids of original projections
                         List<Operator> ss = exp.getSinks();
                         for(Operator s: ss) {
                             if (s instanceof ProjectExpression) {
                                 int inputNum = ((ProjectExpression)s).getInputNum();                             
                                 LogicalRelationalOperator pred = (LogicalRelationalOperator)gen.getPlan().getPredecessors(gen).get(inputNum);
                                
                                 if (pred.getSchema() == null) {
                                     throw new SchemaNotDefinedException("Schema for " + pred.getName() + " is not defined.");
                                 }
                                 if (pred.getSchema().findField(uid) != -1) {                                   
                                     input.add(uid);                                   
                                     found = true;
                                 }
                             }
                         }
                     }
                    
                     if (found) {
                         break;
                     }
                 }
                
                 if (!found) {                   
                     throw new IOException("uid " + uid +" is not in the schema of LOForEach");                   
                 }
             }
             
             // for the flatten bag, we need to make sure at least one field is in the input
             for(int i=0; i<ll.size(); i++) {
                 if (!gen.getFlattenFlags()[i]) {
                     continue;
                 }
                
                 LogicalExpressionPlan exp = ll.get(i);
                 Operator s = exp.getSinks().get(0);
                
                 if (s instanceof ProjectExpression) {
                     int inputNum = ((ProjectExpression)s).getInputNum();      
                     int colNum = ((ProjectExpression)s).getColNum();      
                     LogicalRelationalOperator pred = (LogicalRelationalOperator)gen.getPlan().getPredecessors(gen).get(inputNum);
                    
                     LogicalSchema predSchema = pred.getSchema();
                     if (predSchema == null) {
                         throw new SchemaNotDefinedException("Schema for " + pred.getName() + " is not defined.");
                     }
                    
                     if (predSchema.getField(colNum).type == DataType.BAG) {
                         long fuid = predSchema.getField(colNum).uid;
                         LogicalSchema fschema = predSchema.getField(colNum).schema;
View Full Code Here

                if (op instanceof ProjectExpression) {
                    if (!((ProjectExpression)op).isProjectStar()) {
                        long uid = ((ProjectExpression)op).getUid();
                        uids.add(uid);
                    } else {
                        LogicalRelationalOperator ref = ((ProjectExpression)op).findReferent(currentOp);
                        LogicalSchema s = ref.getSchema();
                        if (s == null) {
                            throw new SchemaNotDefinedException("Schema not defined for " + ref.getAlias());
                        }
                        for(LogicalFieldSchema f: s.getFields()) {
                            uids.add(f.uid);
                        }
                    }
View Full Code Here

    @Override
    protected OperatorPlan buildPattern() {       
        // the pattern that this rule looks for
        // is join -> filter
        LogicalPlan plan = new LogicalPlan();
        LogicalRelationalOperator op1 = new LOJoin(plan);
        LogicalRelationalOperator op2 = new LOFilter(plan);
        plan.add(op1);
        plan.add(op2);
        plan.connect(op1, op2);
       
        return plan;
View Full Code Here

                        uids.add(uid);
                    }
                }
               
                // find the farthest predecessor that has all the fields
                LogicalRelationalOperator input = join;
                List<Operator> preds = currentPlan.getPredecessors(input);
                while(preds != null) {               
                    boolean found = false;
                    for(int j=0; j<preds.size(); j++) {
                        if (hasAll((LogicalRelationalOperator)preds.get(j), uids)) {
View Full Code Here

TOP

Related Classes of org.apache.pig.experimental.logical.relational.LogicalRelationalOperator

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.