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

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


    }

    // get a set of column indexes from a set of uids
    protected Set<Integer> getColumns(LogicalSchema schema, Set<Long> uids) throws IOException {
        if (schema == null) {
            throw new SchemaNotDefinedException("Schema is not defined.");
        }
       
        Set<Integer> cols = new HashSet<Integer>();
        Iterator<Long> iter = uids.iterator();
        while(iter.hasNext()) {
View Full Code Here


           
            if (output.isEmpty()) {
                // to deal with load-store-load-store case
                LogicalSchema s = store.getSchema();
                if (s == null) {
                    throw new SchemaNotDefinedException("Schema for " + store.getName() + " is not defined.");
                }
                               
                for(int i=0; i<s.size(); i++) {
                    output.add(s.getField(i).uid);
                }                                               
View Full Code Here

                     } 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

                        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

            List<Operator> ll = plan.getSuccessors(op);
            Set<Long> uids = new HashSet<Long>();
           
            LogicalSchema s = op.getSchema();
            if (s == null) {
                throw new SchemaNotDefinedException("Schema for " + op.getName() + " is not defined.");
            }
                           
            if (ll != null) {
                // if this is not sink, the output uids are union of input uids of its successors
                for(Operator succ: ll) {
View Full Code Here

TOP

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

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.