@Test
public void testJoinDifferentJoinKeys() throws FrontendException {
LogicalPlan lp = new LogicalPlan();
// Test different join keys
LogicalSchema jaschema6 = new LogicalSchema();
jaschema6.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A6 = new LOLoad(new FileSpec("/abc",
new FuncSpec("/fooload", new String[] {"x", "y"})), jaschema6, lp, null);
lp.add(A6);
// B = load
LogicalSchema jbschema6 = new LogicalSchema();
jbschema6.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
jbschema6.addField(new LogicalSchema.LogicalFieldSchema(
"z", null, DataType.LONG));
LOLoad B6 = new LOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema6, lp, null);
lp.add(B6);
// C = join
LogicalSchema jcschema6 = new LogicalSchema();
jcschema6.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
jcschema6.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LogicalExpressionPlan aprojplan6 = new LogicalExpressionPlan();
new ProjectExpression(aprojplan6, 0, 0, null);
LogicalExpressionPlan bprojplan6 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan6, 1, 0, null);
LogicalExpressionPlan b2projplan6 = new LogicalExpressionPlan();
new ProjectExpression(b2projplan6, 1, 1, null);
MultiMap<Integer, LogicalExpressionPlan> mm6 =
new MultiMap<Integer, LogicalExpressionPlan>();
mm6.put(0, aprojplan6);
mm6.put(1, bprojplan6);
mm6.put(1, b2projplan6);
LOJoin C6 = new LOJoin(lp, mm6, JOINTYPE.HASH, new boolean[] {true, true});
C6.neverUseForRealSetSchema(jcschema6);
lp.add(C6);
lp.connect(A6, C6);
lp.connect(B6, C6);
LogicalSchema jaschema7 = new LogicalSchema();
jaschema7.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A7 = new LOLoad(new FileSpec("/abc",
new FuncSpec("/fooload", new String[] {"x", "y"})), jaschema7, lp, null);
lp.add(A7);
// B = load
LogicalSchema jbschema7 = new LogicalSchema();
jbschema7.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
jbschema7.addField(new LogicalSchema.LogicalFieldSchema(
"z", null, DataType.LONG));
LOLoad B7 = new LOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema7, lp, null);
lp.add(B7);
// C = join
LogicalSchema jcschema7 = new LogicalSchema();
jcschema7.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
jcschema7.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LogicalExpressionPlan aprojplan7 = new LogicalExpressionPlan();
new ProjectExpression(aprojplan7, 0, 0, null);
LogicalExpressionPlan bprojplan7 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan7, 1, 1, null);