Package org.apache.pig.impl.logicalLayer

Examples of org.apache.pig.impl.logicalLayer.FrontendException


                        try {
                            store.getPlan().connect(store, load);
                        } catch (PlanException ex) {
                            int errCode = 2128;
                            String msg = "Failed to connect store with dependent load.";
                            throw new FrontendException(msg, errCode, ex);
                        }
                       

                        
                        //TODO
View Full Code Here


            e.printStackTrace();
        }

        // run through validator
        CompilationMessageCollector collector = new CompilationMessageCollector();
        FrontendException caught = null;
        try {
            LogicalPlanValidationExecutor validator = new LogicalPlanValidationExecutor(
                    plan, pigContext);
            validator.validate(plan, collector);
View Full Code Here

            }
        }
       
        public static void throwInvalidSchemaException() throws FrontendException {
            int errCode = 2218;
            throw new FrontendException("Invalid resource schema: " +
            "bag schema must have tuple as its field", errCode, PigException.BUG);  
        }
View Full Code Here

    }

    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalRelationalNodesVisitor)) {
            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
        }
        ((LogicalRelationalNodesVisitor)v).visit(this);
    }
View Full Code Here

    }

    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalRelationalNodesVisitor)) {
            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
        }
        ((LogicalRelationalNodesVisitor)v).visit(this);
    }
View Full Code Here

        }

        List<Operator> inputs = null;
        inputs = plan.getPredecessors(this);
        if (inputs == null) {
            throw new FrontendException("Cannot get predecessor for " + this, 2233);
        }
       
        List<LogicalFieldSchema> fieldSchemaList = new ArrayList<LogicalFieldSchema>();

        // See if we have more than one expression plans, if so the
        // schema of the group column will be a tuple
        boolean hasMultipleKeys = false;
        for( Integer key : mExpressionPlans.keySet() ) {
            if( mExpressionPlans.get(key).size() > 1 ) {
                hasMultipleKeys = true;
                break;
            }
        }

        LogicalFieldSchema groupKeySchema = null;
        // Generate the groupField Schema
        if( hasMultipleKeys ) {
            LogicalSchema keySchema = new LogicalSchema();
            // We sort here to maintain the correct order of inputs
            for( Integer key : mExpressionPlans.keySet()) {
                Collection<LogicalExpressionPlan> plans =
                    mExpressionPlans.get(key);

                for( LogicalExpressionPlan plan : plans ) {
                    LogicalFieldSchema fieldSchema = getPlanSchema(plan);
                    // if any plan schema is null, that means we can't calculate
                    // further schemas so we bail out
                    if( fieldSchema == null ) {
                        schema = null;
                        return schema;
                    }
                    fieldSchema = new LogicalFieldSchema(fieldSchema);
                    keySchema.addField(fieldSchema);
                }
                // We only need fields from one input and not all
                break;
            }
            groupKeySchema = new LogicalFieldSchema(GROUP_COL_NAME, keySchema, DataType.TUPLE);
        } else {
            // We sort here to maintain the correct order of inputs
            for( Integer key : mExpressionPlans.keySet() ) {
                Collection<LogicalExpressionPlan> plans = mExpressionPlans.get(key);
                for( LogicalExpressionPlan plan : plans ) {
                    groupKeySchema = getPlanSchema(plan);
                    // if any plan schema is null, that means we can't calculate
                    // further schemas so we bail out
                    if( groupKeySchema == null ) {
                        schema = null;
                        return schema;
                    }
                    groupKeySchema = new LogicalSchema.LogicalFieldSchema(groupKeySchema);
                    // Change the uid of this field
                    groupKeySchema.alias = GROUP_COL_NAME;
                    break;
                }
                break;
            }
        }
       
        if (groupKeySchema==null) {
            throw new FrontendException("Cannot get group key schema for " + this, 2234);
        }
        groupKeyUidOnlySchema = groupKeySchema.mergeUid(groupKeyUidOnlySchema);

        fieldSchemaList.add( groupKeySchema );
View Full Code Here

    }

    @Override
    public void accept(PlanVisitor v) throws FrontendException {
        if (!(v instanceof LogicalRelationalNodesVisitor)) {
            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
        }
        ((LogicalRelationalNodesVisitor)v).visit(this);
    }
View Full Code Here

                    Collection<LogicalExpressionPlan> exp2 =
                        oc.mExpressionPlans.get(key);

                    if(! ( exp1 instanceof ArrayList<?>
                    || exp2 instanceof ArrayList<?> ) ) {
                        throw new FrontendException( "Expected an ArrayList " +
                        "of Expression Plans", 2235 );
                    }

                    ArrayList<LogicalExpressionPlan> expList1 =
                        (ArrayList<LogicalExpressionPlan>) exp1;
View Full Code Here

        super(plan, walker);
       
        Iterator<Operator> iter = plan.getOperators();
        while(iter.hasNext()) {
            if (!(iter.next() instanceof LogicalRelationalOperator)) {
                throw new FrontendException("LogicalPlanVisitor can only visit logical plan", 2240);
            }
        }
    }
View Full Code Here

                mergedType = fs1.type;
           
            if (DataType.isSchemaType(mergedType)) {
                mergedSubSchema = merge(fs1.schema, fs2.schema);
                if (mergedSubSchema==null) {
                    throw new FrontendException("Error merging schema " + fs1 + " and " + fs2, 2246);
                }
            }
            LogicalFieldSchema mergedFS = new LogicalFieldSchema(mergedAlias, mergedSubSchema, mergedType);
            mergedSchema.addField(mergedFS);
            if (s1.isTwoLevelAccessRequired() && s2.isTwoLevelAccessRequired()) {
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.logicalLayer.FrontendException

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.