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

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


           
            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
                LogicalExpressionPlan conditionPlan = splitOutput.getFilterPlan();
                if (conditionPlan.getSinks().size()==1) {
                    Operator root = conditionPlan.getSinks().get(0);
                    if (root instanceof ConstantExpression) {
                        Object value = ((ConstantExpression)root).getValue();
                        if (value instanceof Boolean && (Boolean)value==true) {
                            Operator split = splitOutput.getPlan().getPredecessors(splitOutput).get(0);
                            if (split instanceof LOSplit)
                                storePred = store.getPlan().getPredecessors(split).get(0);
                        }
                    }
                }
View Full Code Here


          // position is remembered in order to maintain the order of the successors
          Pair<Integer, Integer> pos = currentPlan.disconnect(op, suc);
          LogicalExpressionPlan filterPlan = new LogicalExpressionPlan();
          LogicalSchema.LogicalFieldSchema fs = new LogicalSchema.LogicalFieldSchema(null, null, DataType.BOOLEAN);
          new ConstantExpression(filterPlan, Boolean.valueOf(true), fs);
          LOSplitOutput splitOutput = new LOSplitOutput((LogicalPlan) currentPlan, filterPlan);
          splitOutput.setAlias(splitOp.getAlias());
          currentPlan.add(splitOutput);
          currentPlan.connect(splitOp, splitOutput);
          currentPlan.connect(splitOutput, pos.first, suc, pos.second);
        }
        UidResetter uidResetter = new UidResetter(currentPlan);
View Full Code Here

           
            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
                LogicalExpressionPlan conditionPlan = splitOutput.getFilterPlan();
                if (conditionPlan.getSinks().size()==1) {
                    Operator root = conditionPlan.getSinks().get(0);
                    if (root instanceof ConstantExpression) {
                        Object value = ((ConstantExpression)root).getValue();
                        if (value instanceof Boolean && (Boolean)value==true) {
                            Operator split = splitOutput.getPlan().getPredecessors(splitOutput).get(0);
                            if (split instanceof LOSplit)
                                storePred = store.getPlan().getPredecessors(split).get(0);
                        }
                    }
                }
View Full Code Here

          // position is remembered in order to maintain the order of the successors
          Pair<Integer, Integer> pos = currentPlan.disconnect(op, suc);
          LogicalExpressionPlan filterPlan = new LogicalExpressionPlan();
          LogicalSchema.LogicalFieldSchema fs = new LogicalSchema.LogicalFieldSchema(null, null, DataType.BOOLEAN);
          new ConstantExpression(filterPlan, Boolean.valueOf(true), fs);
          LOSplitOutput splitOutput = new LOSplitOutput((LogicalPlan) currentPlan, filterPlan);
          splitOutput.setAlias(splitOp.getAlias());
          currentPlan.add(splitOutput);
          currentPlan.connect(splitOp, splitOutput);
          currentPlan.connect(splitOutput, pos.first, suc, pos.second);
        }
       
View Full Code Here

        LOSplit op = new LOSplit( plan );
        return buildOp( loc, op, null, inputAlias, null );
    }
   
    LOSplitOutput createSplitOutputOp() {
        return  new LOSplitOutput( plan );
    }
View Full Code Here

        LOSplit op = new LOSplit( plan );
        return buildOp( loc, op, null, inputAlias, null );
    }

    LOSplitOutput createSplitOutputOp() {
        return  new LOSplitOutput( plan );
    }
View Full Code Here

        LOSplit op = new LOSplit( plan );
        return buildOp( loc, op, null, inputAlias, null );
    }

    LOSplitOutput createSplitOutputOp() {
        return  new LOSplitOutput( plan );
    }
View Full Code Here

        for (Operator suc : sucs) {
            // position is remembered in order to maintain the order of the successors
            Pair<Integer, Integer> pos = plan.disconnect(op, suc);
            LogicalExpressionPlan filterPlan = new LogicalExpressionPlan();
            new ConstantExpression(filterPlan, Boolean.valueOf(true));
            LOSplitOutput splitOutput = new LOSplitOutput((LogicalPlan) plan, filterPlan);
            splitOutput.setAlias(splitOp.getAlias());
            plan.add(splitOutput);
            plan.connect(splitOp, splitOutput);
            plan.connect(splitOutput, pos.first, suc, pos.second);
        }
View Full Code Here

        LOSplit op = new LOSplit( plan );
        return buildOp( loc, op, null, inputAlias, null );
    }

    LOSplitOutput createSplitOutputOp() {
        return  new LOSplitOutput( plan );
    }
View Full Code Here

            // split
            LOSplit split1 = new LOSplit(plan);

            // output1
            LOSplitOutput splitOutput1 = new LOSplitOutput(plan);

            // output2
            LOSplitOutput splitOutput2 = new LOSplitOutput(plan);

            // Create expression inner plan #1
            LogicalExpressionPlan innerPlan1 = new LogicalExpressionPlan();
            ProjectExpression project11 = new ProjectExpression(innerPlan1, 0, 0, splitOutput1);

            ProjectExpression project12 = new ProjectExpression(innerPlan1, 0, 1, splitOutput1);

            NotEqualExpression notequal1 = new NotEqualExpression(innerPlan1, project11, project12);


            // Create expression inner plan #2
            LogicalExpressionPlan innerPlan2 = new LogicalExpressionPlan();
            ProjectExpression project21 = new ProjectExpression(innerPlan2, 0, 0, splitOutput2);

            ConstantExpression const21 = new ConstantExpression(innerPlan2, 26L);
            LessThanEqualExpression lesser21 = new LessThanEqualExpression(innerPlan2, project21, const21);


            splitOutput1.setFilterPlan(innerPlan1);
            splitOutput2.setFilterPlan(innerPlan2);

            plan.add(load1);
            plan.add(split1);
            plan.add(splitOutput1);
            plan.add(splitOutput2);

            plan.connect(load1, split1);
            plan.connect(split1, splitOutput1);
            plan.connect(split1, splitOutput2);

            CompilationMessageCollector collector = new CompilationMessageCollector();
            TypeCheckingRelVisitor typeChecker = new TypeCheckingRelVisitor(plan, collector);
            typeChecker.visit();
            printMessageCollector(collector);
            //printTypeGraph(plan);

            if (collector.hasError()) {
                throw new AssertionError("Expect no error");
            }

            // check split itself
            {
                LogicalSchema endResultSchema1 = split1.getSchema();
                // outer
                assertEquals(DataType.BYTEARRAY, endResultSchema1.getField(0).type);
                assertEquals(DataType.INTEGER, endResultSchema1.getField(1).type);
            }

            // check split output #1
            {
                LogicalSchema endResultSchema1 = splitOutput1.getSchema();
                // outer
                assertEquals(DataType.BYTEARRAY, endResultSchema1.getField(0).type);
                assertEquals(DataType.INTEGER, endResultSchema1.getField(1).type);
            }

            // check split output #2
            {
                LogicalSchema endResultSchema2 = splitOutput2.getSchema();
                // outer
                assertEquals(DataType.BYTEARRAY, endResultSchema2.getField(0).type);
                assertEquals(DataType.INTEGER, endResultSchema2.getField(1).type);
            }
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.logical.relational.LOSplitOutput

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.