本文整理汇总了Java中org.apache.pig.newplan.logical.relational.LogicalPlan.getPredecessors方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalPlan.getPredecessors方法的具体用法?Java LogicalPlan.getPredecessors怎么用?Java LogicalPlan.getPredecessors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.newplan.logical.relational.LogicalPlan
的用法示例。
在下文中一共展示了LogicalPlan.getPredecessors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: printSimple
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
public static void printSimple(Operator op, LogicalPlan lp,
Map<Operator, DataBag> exampleData) {
DataBag bag = exampleData.get(op);
List<Operator> inputs = lp.getPredecessors(op);
if (inputs != null) {
for (Operator lOp : inputs) {
printSimple(lOp, lp, exampleData);
}
}
if (((LogicalRelationalOperator)op).getAlias() != null) {
// printTable(op, bag, output);
// DisplayTable(MakeArray(op, bag), op, bag, output);
System.out.println(((LogicalRelationalOperator)op).getAlias() + " : " + bag);
}
// System.out.println(op.getAlias() + " : " + bag);
}
示例3: testFullOutJoin1
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
/**
* Cascading joins. First one has outer, but filter should be able to push up above the second one, but below
* the first one.
*/
@Test
public void testFullOutJoin1() throws Exception {
String query = "A = load 'myfile' as (d1:int);" +
"B = load 'anotherfile' as (d2:int);" +
"C = join A by d1 full outer, B by d2;" +
"D = load 'xxx' as (d3:int);" +
"E = join C by d1, D by d3;" +
"F = filter E by d1 > 5;" +
"G = store F into 'dummy';";
LogicalPlan newLogicalPlan = migrateAndOptimizePlan(query);
List<Operator> ops = newLogicalPlan.getSinks();
Assert.assertTrue( ops.size() == 1 );
Operator op = ops.get( 0 );
Assert.assertTrue( op instanceof LOStore );
Operator join = newLogicalPlan.getPredecessors(op).get( 0 );
Assert.assertTrue( join instanceof LOJoin );
ops = newLogicalPlan.getPredecessors(join);
Assert.assertEquals( 2, ops.size() );
Assert.assertTrue( ops.get( 0 ) instanceof LOFilter || ops.get( 1 ) instanceof LOFilter );
}
示例4: findColNum
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
private int findColNum(String alias) throws FrontendException {
LogicalPlan lp = (LogicalPlan)attachedRelationalOp.getPlan();
List<Operator> inputs = lp.getPredecessors( attachedRelationalOp );
LogicalRelationalOperator input = (LogicalRelationalOperator)inputs.get( getInputNum() );
LogicalSchema inputSchema = input.getSchema();
if( alias != null ) {
int colNum = inputSchema == null ? -1 : inputSchema.getFieldPosition( alias );
if( colNum == -1 ) {
String msg = "Invalid field projection. Projected field [" + alias + "] does not exist";
if( inputSchema != null )
msg += " in schema: " + inputSchema.toString( false );
msg += ".";
throw new PlanValidationException( this, msg, 1025 );
}
return colNum;
} else {
int col = getColNum();
if( inputSchema != null && col >= inputSchema.size() ) {
throw new PlanValidationException( this,
"Out of bound access. Trying to access non-existent column: " +
col + ". Schema " + inputSchema.toString(false) +
" has " + inputSchema.size() + " column(s)." , 1000);
}
return col;
}
}