// No tests for LOStore because it tries to actually instantiate the store
// func, and I don't want to mess with that here.
@Test
public void testJoinDifferentJoinTypes() throws IOException {
LogicalPlan lp = new LogicalPlan();
LogicalSchema jaschema1 = new LogicalSchema();
jaschema1.addField(new LogicalSchema.LogicalFieldSchema(
"x", null, DataType.INTEGER));
LOLoad A1 = new LOLoad(new FileSpec("/abc",
new FuncSpec("/fooload", new String[] {"x", "y"})), jaschema1, lp);
lp.add(A1);
// B = load
LogicalSchema jbschema1 = new LogicalSchema();
jbschema1.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LOLoad B1 = new LOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema1, lp);
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, DataType.INTEGER, 0, 0);
LogicalExpressionPlan bprojplan1 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan1, DataType.INTEGER, 1, 0);
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 = new LOLoad(new FileSpec("/abc",
new FuncSpec("/fooload", new String[] {"x", "y"})), jaschema2, lp);
lp.add(A2);
// B = load
LogicalSchema jbschema2 = new LogicalSchema();
jbschema2.addField(new LogicalSchema.LogicalFieldSchema(
"y", null, DataType.INTEGER));
LOLoad B2 = new LOLoad(new FileSpec("/def",
new FuncSpec("PigStorage", "\t")), jbschema2, lp);
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, DataType.INTEGER, 0, 0);
LogicalExpressionPlan bprojplan2 = new LogicalExpressionPlan();
new ProjectExpression(bprojplan2, DataType.INTEGER, 1, 0);
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));
}