Package org.apache.pig.newplan.logical.relational

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


            // the input
            long firstUid=-1;
            Map<Integer,Long> generatedInputUids = cg.getGeneratedInputUids();
            for( Map.Entry<Integer, Long> entry : generatedInputUids.entrySet() ) {
                Long uid = entry.getValue();
                LogicalRelationalOperator pred =
                    (LogicalRelationalOperator) cg.getPlan().getPredecessors(cg).get(entry.getKey());
                if( output.contains(uid) ) {
                    // Hence we need to all the full schema of the bag
                    input.addAll( getAllUids( pred.getSchema() ) );
                }
                if (pred.getSchema()!=null)
                    firstUid = pred.getSchema().getField(0).uid;
            }

            if (input.isEmpty() && firstUid!=-1) {
                input.add(firstUid);
            }
View Full Code Here


        public void visit(LOStream stream) throws FrontendException {
            // output is not used, setOutputUids is used to check if it has output schema
            Set<Long> output = setOutputUids(stream);

            // Every field is required
            LogicalRelationalOperator pred = (LogicalRelationalOperator)plan.getPredecessors(stream).get(0);

            Set<Long> input = getAllUids(pred.getSchema());

            stream.annotate(INPUTUIDS, input);
        }
View Full Code Here

            Set<Long> input = (Set<Long>)gen.getAnnotation(INPUTUIDS);

            // Make sure at least one column will retain
            if (input.isEmpty()) {
                LogicalRelationalOperator pred = (LogicalRelationalOperator)plan.getPredecessors(foreach).get(0);
                if (pred.getSchema()!=null)
                    input.add(pred.getSchema().getField(0).uid);
            }
            foreach.annotate(INPUTUIDS, input);
        }
View Full Code Here

                if (op instanceof ProjectExpression) {
                    if (!((ProjectExpression)op).isRangeOrStarProject()) {
                        long uid = ((ProjectExpression)op).getFieldSchema().uid;
                        uids.add(uid);
                    } else {
                        LogicalRelationalOperator ref = ((ProjectExpression)op).findReferent();
                        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() {
        LogicalPlan plan = new LogicalPlan();
        LogicalRelationalOperator op1 = new LOFilter(plan);
        plan.add( op1 );

        return plan;
    }
View Full Code Here

    @Override
    protected OperatorPlan buildPattern() {
        // match each foreach.
        LogicalPlan plan = new LogicalPlan();
        LogicalRelationalOperator load = new LOLoad (null, plan);
        plan.add( load );
//        LogicalRelationalOperator filter = new LOFilter( plan );
//        plan.add( filter );
//        plan.connect( load, filter );
        return plan;
View Full Code Here

            // Get the uid for this projection.  It must match the uid of the
            // value it is projecting.
            long myUid = p.getFieldSchema().uid;
           
            // Find the operator this projection references
            LogicalRelationalOperator pred = p.findReferent();
           
            if (p.getAttachedRelationalOp() instanceof LOGenerate && p.getPlan().getSuccessors(p)==null) {
                // No need to adjust
                return;
            }
            else {
                // Get the schema for this operator and search it for the matching uid
                int match = -1;
                LogicalSchema schema = pred.getSchema();
                if (schema==null)
                    return;
                List<LogicalSchema.LogicalFieldSchema> fields = schema.getFields();
                for (int i = 0; i < fields.size(); i++) {
                    if (fields.get(i).uid == myUid) {
View Full Code Here

    }

    @Override
    protected OperatorPlan buildPattern() {
        LogicalPlan plan = new LogicalPlan();
        LogicalRelationalOperator op = new LOCogroup(plan);
        plan.add(op);
        return plan;
    }
View Full Code Here

        @Override
        public boolean check(OperatorPlan matched) throws FrontendException {
            Iterator<Operator> iter = matched.getOperators();
            while(iter.hasNext()) {
                LogicalRelationalOperator op = (LogicalRelationalOperator)iter.next();
                if ((op instanceof LOFilter||op instanceof LOSort||op instanceof LOJoin||
                        op instanceof LOSplitOutput) && shouldAdd(op)) {
                    opForAdd = op;
                    return true;
                }
View Full Code Here

    @Override
    protected OperatorPlan buildPattern() {       
        // the pattern that this rule looks for
        // is filter operator
        LogicalPlan plan = new LogicalPlan();
        LogicalRelationalOperator op = new LOFilter(plan);
        plan.add(op);       
       
        return plan;
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.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.