当前位置: 首页>>代码示例>>Java>>正文


Java LogicalPlan.getSuccessors方法代码示例

本文整理汇总了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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:19,代码来源:ColumnPruneVisitor.java

示例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;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:41,代码来源:Util.java

示例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 );
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:15,代码来源:TestNewPlanPushDownForeachFlatten.java

示例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");
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:18,代码来源:TestLogicalPlanBuilder.java

示例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");
}
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:18,代码来源:TestLogicalPlanBuilder.java

示例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;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:42,代码来源:Util.java


注:本文中的org.apache.pig.newplan.logical.relational.LogicalPlan.getSuccessors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。