本文整理汇总了Java中org.apache.pig.newplan.logical.relational.LogicalPlan.insertBetween方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalPlan.insertBetween方法的具体用法?Java LogicalPlan.insertBetween怎么用?Java LogicalPlan.insertBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.newplan.logical.relational.LogicalPlan
的用法示例。
在下文中一共展示了LogicalPlan.insertBetween方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例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);
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;
}