本文整理汇总了Java中org.apache.pig.newplan.logical.relational.LogicalPlan.add方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalPlan.add方法的具体用法?Java LogicalPlan.add怎么用?Java LogicalPlan.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.newplan.logical.relational.LogicalPlan
的用法示例。
在下文中一共展示了LogicalPlan.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLoadEqualityDifferentNumFuncSpecCstorArgs
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testLoadEqualityDifferentNumFuncSpecCstorArgs() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema aschema1 = new LogicalSchema();
aschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad load1 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "y" })), aschema1, lp,
conf);
lp.add(load1);
LOLoad load3 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), "x")), aschema1, lp, conf);
lp.add(load3);
assertFalse(load1.isEqual(load3));
}
示例2: testLoadEqualityDifferentFunctionNames
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testLoadEqualityDifferentFunctionNames() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema aschema1 = new LogicalSchema();
aschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad load1 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "y" })), aschema1, lp,
conf);
lp.add(load1);
// Different function names in FuncSpec
LOLoad load4 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "z" })), aschema1, lp,
conf);
lp.add(load4);
assertFalse(load1.isEqual(load4));
}
示例3: testLoadEqualityDifferentFileName
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testLoadEqualityDifferentFileName() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema aschema1 = new LogicalSchema();
aschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad load1 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "y" })), aschema1, lp,
conf);
lp.add(load1);
// Different file name
LOLoad load5 = newLOLoad(new FileSpec("/def",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "z" })), aschema1, lp,
conf);
lp.add(load5);
assertFalse(load1.isEqual(load5));
}
示例4: testLoadEqualityDifferentFuncSpecCtorArgs
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testLoadEqualityDifferentFuncSpecCtorArgs() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema aschema1 = new LogicalSchema();
aschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad load1 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "y" })), aschema1, lp,
conf);
lp.add(load1);
LOLoad load2 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "z" })), aschema1, lp,
conf);
lp.add(load2);
assertFalse(load1.isEqual(load2));
}
示例5: buildPattern
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Override
protected OperatorPlan buildPattern() {
LogicalPlan plan = new LogicalPlan();
LogicalRelationalOperator foreach = new LOForEach(plan);
plan.add( foreach );
return plan;
}
示例6: buildPattern
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Override
protected OperatorPlan buildPattern() {
LogicalPlan plan = new LogicalPlan();
LogicalRelationalOperator op1 = new LOFilter(plan);
plan.add( op1 );
return plan;
}
示例7: buildPattern
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Override
protected OperatorPlan buildPattern() {
// match each foreach.
LogicalPlan plan = new LogicalPlan();
LogicalRelationalOperator foreach1 = new LOForEach(plan);
plan.add( foreach1 );
return plan;
}
示例8: buildNestedOp
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
private void buildNestedOp(SourceLocation loc, LogicalPlan plan, LogicalRelationalOperator op,
String alias, List<Operator> inputOpList) {
op.setLocation( loc );
setAlias( op, alias );
plan.add( op );
for (Operator inputOp : inputOpList) {
plan.connect( inputOp, op );
}
}
示例9: buildPattern
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Override
protected OperatorPlan buildPattern() {
LogicalPlan plan = new LogicalPlan();
LogicalRelationalOperator load = new LOLoad(null, plan);
plan.add(load);
return plan;
}
示例10: testFilterDifferentPredicates
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testFilterDifferentPredicates() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalExpressionPlan fp1 = new LogicalExpressionPlan();
ProjectExpression fy1 = new ProjectExpression(fp1, 0, 1, null);
ConstantExpression fc1 = new ConstantExpression(fp1,
new Integer(0));
new EqualExpression(fp1, fy1, fc1);
LOFilter D1 = new LOFilter(lp, fp1);
LogicalSchema cschema = new LogicalSchema();
cschema.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
cschema.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
D1.neverUseForRealSetSchema(cschema);
lp.add(D1);
LogicalExpressionPlan fp2 = new LogicalExpressionPlan();
ProjectExpression fy2 = new ProjectExpression(fp2, 0, 1, null);
ConstantExpression fc2 = new ConstantExpression(fp2,
new Integer(1));
new EqualExpression(fp2, fy2, fc2);
LOFilter D2 = new LOFilter(lp, fp2);
D2.neverUseForRealSetSchema(cschema);
lp.add(D2);
assertFalse(D1.isEqual(D2));
}
示例11: testJoinDifferentJoinTypes
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testJoinDifferentJoinTypes() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema jaschema1 = new LogicalSchema();
jaschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A1 = newLOLoad(new FileSpec("/abc",
new FuncSpec("org.apache.pig.test.TestNewPlanOperatorPlan$FooLoad", new String[] {
"x", "y" })), jaschema1, lp, conf);
lp.add(A1);
// B = load
LogicalSchema jbschema1 = new LogicalSchema();
jbschema1.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LOLoad B1 = newLOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema1, lp, conf);
lp.add(B1);
// C = join
LogicalSchema jcschema1 = new LogicalSchema();
jcschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
jcschema1.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LogicalExpressionPlan aprojplan1 = new LogicalExpressionPlan();
new ProjectExpression(aprojplan1, 0, 0, null);
LogicalExpressionPlan bprojplan1 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan1, 1, 0, null);
MultiMap<Integer, LogicalExpressionPlan> mm1 =
new MultiMap<Integer, LogicalExpressionPlan>();
mm1.put(0, aprojplan1);
mm1.put(1, bprojplan1);
LOJoin C1 = new LOJoin(lp, mm1, JOINTYPE.HASH, new boolean[] { true, true });
C1.neverUseForRealSetSchema(jcschema1);
lp.add(C1);
lp.connect(A1, C1);
lp.connect(B1, C1);
// A = load
LogicalSchema jaschema2 = new LogicalSchema();
jaschema2.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A2 = newLOLoad(new FileSpec("/abc",
new FuncSpec("org.apache.pig.test.TestNewPlanOperatorPlan$FooLoad", new String[] {
"x", "y" })), jaschema2, lp, conf);
lp.add(A2);
// B = load
LogicalSchema jbschema2 = new LogicalSchema();
jbschema2.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LOLoad B2 = newLOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema2, lp, conf);
lp.add(B2);
// C = join
LogicalSchema jcschema2 = new LogicalSchema();
jcschema2.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
jcschema2.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LogicalExpressionPlan aprojplan2 = new LogicalExpressionPlan();
new ProjectExpression(aprojplan2, 0, 0, null);
LogicalExpressionPlan bprojplan2 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan2, 1, 0, null);
MultiMap<Integer, LogicalExpressionPlan> mm2 =
new MultiMap<Integer, LogicalExpressionPlan>();
mm2.put(0, aprojplan2);
mm2.put(1, bprojplan2);
LOJoin C2 = new LOJoin(lp, mm2, JOINTYPE.SKEWED, new boolean[] { true, true });
C2.neverUseForRealSetSchema(jcschema2);
lp.add(C2);
lp.connect(A2, C2);
lp.connect(B2, C2);
assertFalse(C1.isEqual(C2));
}
示例12: buildPattern
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Override
protected OperatorPlan buildPattern() {
LogicalPlan plan = new LogicalPlan();
plan.add(new LOStream(plan, null, null, null));
return plan;
}
示例13: testRelationalSameOpDifferentPreds
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testRelationalSameOpDifferentPreds() throws FrontendException {
LogicalPlan lp1 = new LogicalPlan();
LogicalSchema aschema1 = new LogicalSchema();
aschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A1 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "y" })), aschema1, lp1,
conf);
lp1.add(A1);
LogicalExpressionPlan fp1 = new LogicalExpressionPlan();
ProjectExpression fy1 = new ProjectExpression(fp1, 0, 0, null);
ConstantExpression fc1 = new ConstantExpression(fp1,
new Integer(0));
new EqualExpression(fp1, fy1, fc1);
LOFilter D1 = new LOFilter(lp1, fp1);
LogicalSchema cschema = new LogicalSchema();
cschema.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
D1.neverUseForRealSetSchema(cschema);
lp1.add(D1);
lp1.connect(A1, D1);
LogicalPlan lp2 = new LogicalPlan();
LOLoad A2 = newLOLoad(new FileSpec("/abc",
new FuncSpec(DummyLoad.class.getName(), new String[] { "x", "z" })), null, lp2,
conf);
lp2.add(A2);
LogicalExpressionPlan fp2 = new LogicalExpressionPlan();
ProjectExpression fy2 = new ProjectExpression(fp2, 0, 0, null);
ConstantExpression fc2 = new ConstantExpression(fp2,
new Integer(0));
new EqualExpression(fp2, fy2, fc2);
LOFilter D2 = new LOFilter(lp2, fp2);
D2.neverUseForRealSetSchema(cschema);
lp2.add(D2);
lp2.connect(A2, D2);
assertTrue(D1.isEqual(D2));
}
示例14: testCross1
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testCross1() throws Throwable {
printCurrentMethodName();
LogicalPlan plan = new LogicalPlan();
LOLoad load1 = genDummyLOLoadNewLP(plan);
LOLoad load2 = genDummyLOLoadNewLP(plan);
String[] aliases1 = new String[]{ "a", "b", "c" };
byte[] types1 = new byte[] { DataType.INTEGER, DataType.LONG, DataType.BYTEARRAY };
Schema schema1 = genFlatSchema(aliases1, types1);
String[] aliases2 = new String[]{ "e", "f" };
byte[] types2 = new byte[] { DataType.FLOAT, DataType.DOUBLE };
Schema schema2 = genFlatSchema(aliases2, types2);
// set schemas
load1.setScriptSchema(org.apache.pig.newplan.logical.Util.translateSchema(schema1));
load2.setScriptSchema(org.apache.pig.newplan.logical.Util.translateSchema(schema2));
LOCross cross = new LOCross(plan);
// wiring
plan.add(load1);
plan.add(load2);
plan.add(cross);
plan.connect(load1, cross);
plan.connect(load2, cross);
// validate
CompilationMessageCollector collector = new CompilationMessageCollector();
TypeCheckingRelVisitor typeChecker = new TypeCheckingRelVisitor(plan, collector);
typeChecker.visit();
printMessageCollector(collector);
//printTypeGraph(plan);
assertEquals(5, cross.getSchema().size());
assertEquals(DataType.INTEGER, cross.getSchema().getField(0).type);
assertEquals(DataType.LONG, cross.getSchema().getField(1).type);
assertEquals(DataType.BYTEARRAY, cross.getSchema().getField(2).type);
assertEquals(DataType.FLOAT, cross.getSchema().getField(3).type);
assertEquals(DataType.DOUBLE, cross.getSchema().getField(4).type);
}
示例15: testJoinDifferentInner
import org.apache.pig.newplan.logical.relational.LogicalPlan; //导入方法依赖的package包/类
@Test
public void testJoinDifferentInner() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema jaschema1 = new LogicalSchema();
jaschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A1 = newLOLoad(new FileSpec("/abc",
new FuncSpec("org.apache.pig.test.TestNewPlanOperatorPlan$FooLoad", new String[] {
"x", "y" })), jaschema1, lp, conf);
lp.add(A1);
// B = load
LogicalSchema jbschema1 = new LogicalSchema();
jbschema1.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LOLoad B1 = newLOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema1, lp, conf);
lp.add(B1);
// C = join
LogicalSchema jcschema1 = new LogicalSchema();
jcschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
jcschema1.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LogicalExpressionPlan aprojplan1 = new LogicalExpressionPlan();
new ProjectExpression(aprojplan1, 0, 0, null);
LogicalExpressionPlan bprojplan1 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan1, 1, 0, null);
MultiMap<Integer, LogicalExpressionPlan> mm1 =
new MultiMap<Integer, LogicalExpressionPlan>();
mm1.put(0, aprojplan1);
mm1.put(1, bprojplan1);
LOJoin C1 = new LOJoin(lp, mm1, JOINTYPE.HASH, new boolean[] { true, true });
C1.neverUseForRealSetSchema(jcschema1);
lp.add(C1);
lp.connect(A1, C1);
lp.connect(B1, C1);
// Test different inner status
// A = load
LogicalSchema jaschema3 = new LogicalSchema();
jaschema3.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A3 = newLOLoad(new FileSpec("/abc",
new FuncSpec("org.apache.pig.test.TestNewPlanOperatorPlan$FooLoad", new String[] {
"x", "y" })), jaschema3, lp, conf);
lp.add(A3);
// B = load
LogicalSchema jbschema3 = new LogicalSchema();
jbschema3.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LOLoad B3 = newLOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema3, lp, conf);
lp.add(B3);
// C = join
LogicalSchema jcschema3 = new LogicalSchema();
jcschema3.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
jcschema3.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LogicalExpressionPlan aprojplan3 = new LogicalExpressionPlan();
new ProjectExpression(aprojplan3, 0, 0, null);
LogicalExpressionPlan bprojplan3 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan3, 1, 0, null);
MultiMap<Integer, LogicalExpressionPlan> mm3 =
new MultiMap<Integer, LogicalExpressionPlan>();
mm3.put(0, aprojplan3);
mm3.put(1, bprojplan3);
LOJoin C3 = new LOJoin(lp, mm3, JOINTYPE.HASH, new boolean[] { true, false });
C3.neverUseForRealSetSchema(jcschema3);
lp.add(C3);
lp.connect(A3, C3);
lp.connect(B3, C3);
assertFalse(C1.isEqual(C3));
}