本文整理汇总了Java中org.apache.pig.newplan.logical.relational.LogicalPlan.getSuccessors方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalPlan.getSuccessors方法的具体用法?Java LogicalPlan.getSuccessors怎么用?Java LogicalPlan.getSuccessors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.newplan.logical.relational.LogicalPlan
的用法示例。
在下文中一共展示了LogicalPlan.getSuccessors方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeSubTree
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
private void removeSubTree(LogicalRelationalOperator op) throws FrontendException {
LogicalPlan p = (LogicalPlan)op.getPlan();
List<Operator> ll = p.getPredecessors(op);
if (ll != null) {
for(Operator pred: ll.toArray(new Operator[ll.size()])) {
removeSubTree((LogicalRelationalOperator)pred);
}
}
if (p.getSuccessors(op) != null) {
Operator[] succs = p.getSuccessors(op).toArray(new Operator[0]);
for(Operator s: succs) {
p.disconnect(op, s);
}
}
p.remove(op);
}
示例2: addForEachAfter
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
public static LOForEach addForEachAfter(LogicalPlan plan, LogicalRelationalOperator op, int branch,
Set<Integer> columnsToDrop) throws FrontendException {
LOForEach foreach = new LOForEach(plan);
plan.add(foreach);
List<Operator> next = plan.getSuccessors(op);
if (next != null) {
LogicalRelationalOperator nextOp = (LogicalRelationalOperator)next.get(branch);
plan.insertBetween(op, foreach, nextOp);
}
else {
plan.connect(op, foreach);
}
LogicalPlan innerPlan = new LogicalPlan();
foreach.setInnerPlan(innerPlan);
LogicalSchema schema = op.getSchema();
// build foreach inner plan
List<LogicalExpressionPlan> exps = new ArrayList<LogicalExpressionPlan>();
LOGenerate gen = new LOGenerate(innerPlan, exps, new boolean[schema.size()-columnsToDrop.size()]);
innerPlan.add(gen);
for (int i=0, j=0; i<schema.size(); i++) {
if (columnsToDrop.contains(i)) {
continue;
}
LOInnerLoad innerLoad = new LOInnerLoad(innerPlan, foreach, i);
innerPlan.add(innerLoad);
innerPlan.connect(innerLoad, gen);
LogicalExpressionPlan exp = new LogicalExpressionPlan();
ProjectExpression prj = new ProjectExpression(exp, j++, -1, gen);
exp.add(prj);
exps.add(exp);
}
return foreach;
}
示例3: testErrorNonForeachInput
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
/**
* No foreach in the plan, no effect.
*/
@Test
public void testErrorNonForeachInput() throws Exception {
String query = "A = load 'myfile' as (name, age, gpa);" +
"store A into 'output';";
LogicalPlan newLogicalPlan = migrateAndOptimizePlan( query );
Operator load = newLogicalPlan.getSources().get( 0 );
Assert.assertTrue( load instanceof LOLoad );
List<Operator> nexts = newLogicalPlan.getSuccessors( load );
Assert.assertTrue( nexts != null && nexts.size() == 1 );
}
示例4: testQuery18
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
/**
* Validate that parallel is parsed correctly Bug 831714 - fixed
*/
@Test //PIG-1996
public void testQuery18() throws Exception {
String query = "store (FOREACH (group (load 'a') ALL PARALLEL 16) generate group ) into 'y';";
LogicalPlan lp = buildPlan(query);
Operator root = lp.getSources().get(0);
List<Operator> listOp = lp.getSuccessors(root);
Operator lo = listOp.get(0);
if (lo instanceof LOCogroup) {
Assert.assertEquals( 1, ((LOCogroup) lo).getRequestedParallelism() );//Local mode, paraallel = 1
} else {
Assert.fail("Error: Unexpected Parse Tree output");
}
}
示例5: testQuery18
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
/**
* Validate that parallel is parsed correctly Bug 831714 - fixed
*/
@Test //PIG-1996
public void testQuery18() throws Exception {
String query = "store (FOREACH (group (load 'a') ALL PARALLEL 16) generate group ) into 'y';";
LogicalPlan lp = buildPlan(query);
Operator root = lp.getSources().get(0);
List<Operator> listOp = lp.getSuccessors(root);
Operator lo = listOp.get(0);
if (lo instanceof LOCogroup) {
Assert.assertEquals( 16, ((LOCogroup) lo).getRequestedParallelism() );
} else {
Assert.fail("Error: Unexpected Parse Tree output");
}
}
示例6: addForEachAfter
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
public static LOForEach addForEachAfter(LogicalPlan plan, LogicalRelationalOperator op, int branch,
Set<Integer> columnsToDrop) throws FrontendException {
LOForEach foreach = new LOForEach(plan);
plan.add(foreach);
List<Operator> next = plan.getSuccessors(op);
if (next != null) {
LogicalRelationalOperator nextOp = (LogicalRelationalOperator)next.get(branch);
plan.insertBetween(op, foreach, nextOp);
foreach.setAlias(op.getAlias());
}
else {
plan.connect(op, foreach);
}
LogicalPlan innerPlan = new LogicalPlan();
foreach.setInnerPlan(innerPlan);
LogicalSchema schema = op.getSchema();
// build foreach inner plan
List<LogicalExpressionPlan> exps = new ArrayList<LogicalExpressionPlan>();
LOGenerate gen = new LOGenerate(innerPlan, exps, new boolean[schema.size()-columnsToDrop.size()]);
innerPlan.add(gen);
for (int i=0, j=0; i<schema.size(); i++) {
if (columnsToDrop.contains(i)) {
continue;
}
LOInnerLoad innerLoad = new LOInnerLoad(innerPlan, foreach, i);
innerPlan.add(innerLoad);
innerPlan.connect(innerLoad, gen);
LogicalExpressionPlan exp = new LogicalExpressionPlan();
ProjectExpression prj = new ProjectExpression(exp, j++, -1, gen);
exp.add(prj);
exps.add(exp);
}
return foreach;
}