Examples of LogicalOperator


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

        {
            LOProject project = projectFinder.getProjectSet().iterator().next();
            if (innerPlan.getPredecessors(project)==null)
            {
                relayingMapKeys = true;
                LogicalOperator pred = project;
                while (innerPlan.getSuccessors(pred)!=null)
                {
                    if (innerPlan.getSuccessors(pred).size()!=1)
                        return false;
                    if (!(innerPlan.getSuccessors(pred).get(0) instanceof LOCast))
View Full Code Here

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

                log.warn("fieldsToRead on "+load+" throw an exception, skip it");
            }
        }
       
        // Loader does not support column pruning, insert foreach
        LogicalOperator forEach = null;
        if (response==null || !response.getRequiredFieldResponse())
        {
            List<Integer> columnsToProject = new ArrayList<Integer>();
            for (RequiredField rf : requiredFieldList.getFields())
                columnsToProject.add(rf.getIndex());
View Full Code Here

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

                List<LogicalOperator> listOp = lp.getSuccessors(op);
               
                if(null != listOp) {
                    Iterator<LogicalOperator> iter = listOp.iterator();
                    while(iter.hasNext()) {
                        LogicalOperator lop = iter.next();
                        System.err.println("Successor: " + lop.getClass().getName() + " object " + lop);
                    }
                }
            }
           
            assertTrue(lp != null);
View Full Code Here

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

        }

        @Override
        protected void visit(LOStore store) throws VisitorException {
           
            LogicalOperator storePred = store.getPlan().getPredecessors(store).get(0);
            if(storePred == null){
                int errCode = 2051;
                String msg = "Did not find a predecessor for Store." ;
                throw new VisitorException(msg, errCode, PigException.BUG);   
            }
           
            SortInfo sortInfo = null;
            if(storePred instanceof LOLimit) {
                storePred = store.getPlan().getPredecessors(storePred).get(0);
            } else if (storePred instanceof LOSplitOutput) {
                LOSplitOutput splitOutput = (LOSplitOutput)storePred;
                // We assume this is the LOSplitOutput we injected for this case:
                // b = order a by $0; store b into '1'; store b into '2';
                // In this case, we should mark both '1' and '2' as sorted
                LogicalPlan conditionPlan = splitOutput.getConditionPlan();
                if (conditionPlan.getRoots().size()==1) {
                    LogicalOperator root = conditionPlan.getRoots().get(0);
                    if (root instanceof LOConst) {
                        Object value = ((LOConst)root).getValue();
                        if (value instanceof Boolean && (Boolean)value==true) {
                            LogicalOperator split = splitOutput.getPlan().getPredecessors(splitOutput).get(0);
                            if (split instanceof LOSplit)
                                storePred = store.getPlan().getPredecessors(split).get(0);
                        }
                    }
                }
View Full Code Here

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

        LogicalPlan getPlan(String alias) throws IOException {
            LogicalPlan plan = lp;
               
            if (alias != null) {
                LogicalOperator op = aliasOp.get(alias);
                if(op == null) {
                    int errCode = 1003;
                    String msg = "Unable to find an operator for alias " + alias;
                    throw new FrontendException(msg, errCode, PigException.INPUT);
                }
View Full Code Here

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

            LogicalPlan tmpLp = parseQuery(query, startLine);
           
            // store away the query for use in cloning later
            scriptCache.add(query);
            if (tmpLp.getLeaves().size() == 1) {
                LogicalOperator op = tmpLp.getSingleLeafPlanOutputOp();
               
                // Check if we just processed a LOStore i.e. STORE
                if (op instanceof LOStore) {

                    if (!batchMode) {
                        lp = tmpLp;
                        try {
                            execute();
                        } catch (Exception e) {
                            int errCode = 1002;
                            String msg = "Unable to store alias "
                                    + op.getOperatorKey().getId();
                            throw new FrontendException(msg, errCode,
                                    PigException.INPUT, e);
                        }
                    } else {
                        if (0 == ignoreNumStores) {
View Full Code Here

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

     * @throws IOException
     */
    public Schema dumpSchemaNested(String alias, String nestedAlias) throws IOException{
        LogicalPlan lp = getPlanFromAlias(alias, "describe");
        lp = compileLp(alias, false);
        LogicalOperator op = lp.getLeaves().get(0);
        if(op instanceof LOForEach) {
            return ((LOForEach)op).dumpNestedSchema(alias, nestedAlias);
        }
        else {
            int errCode = 1001;
View Full Code Here

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

     * @return iterator of tuples returned from the script
     * @throws IOException
     */
    public Iterator<Tuple> openIterator(String id) throws IOException {
        try {
            LogicalOperator op = currDAG.getAliasOp().get(id);
            if(null == op) {
                int errCode = 1003;
                String msg = "Unable to find an operator for alias " + id;
                throw new FrontendException(msg, errCode, PigException.INPUT);
            }
View Full Code Here

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

            // MRCompiler needs a store to be the leaf - hence
            // add a store to the plan to explain
           
            // figure out the leaf to which the store needs to be added
            List<LogicalOperator> leaves = lp.getLeaves();
            LogicalOperator leaf = null;
            if(leaves.size() == 1) {
                leaf = leaves.get(0);
            } else {
                for (Iterator<LogicalOperator> it = leaves.iterator(); it.hasNext();) {
                    LogicalOperator leafOp = it.next();
                    if(leafOp.getAlias().equals(id))
                        leaf = leafOp;
                }
            }
           
            LogicalPlan unCompiledstorePlan = QueryParser.generateStorePlan(
View Full Code Here

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

            // MRCompiler needs a store to be the leaf - hence
            // add a store to the plan to explain
           
            // figure out the leaves to which stores need to be added
            List<LogicalOperator> leaves = lp.getLeaves();
            LogicalOperator leaf = null;
            if(leaves.size() == 1) {
                leaf = leaves.get(0);
            } else {
                for (Iterator<LogicalOperator> it = leaves.iterator(); it.hasNext();) {
                    LogicalOperator leafOp = it.next();
                    if(leafOp.getAlias().equals(alias))
                        leaf = leafOp;
                }
            }
           
            lp = QueryParser.generateStorePlan(scope, lp, "fakefile",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.