@Test public void testFullOuterJoinWithoutMatchingPartners() throws Exception { final List<String> leftInput = Arrays.asList("foo", "bar", "foobar"); final List<String> rightInput = Arrays.asList("oof", "rab", "raboof"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL); List<String> expected = Arrays.asList("bar,null", "foo,null", "foobar,null", "null,oof", "null,rab", "null,raboof"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testFullOuterJoinWithFullMatchingKeys() throws Exception { final List<String> leftInput = Arrays.asList("foo", "bar", "foobar"); final List<String> rightInput = Arrays.asList("bar", "foobar", "foo"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL); List<String> expected = Arrays.asList("bar,bar", "foo,foo", "foobar,foobar"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testFullOuterJoinWithPartialMatchingKeys() throws Exception { final List<String> leftInput = Arrays.asList("foo", "bar", "foobar"); final List<String> rightInput = Arrays.asList("bar", "foo", "barfoo"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL); List<String> expected = Arrays.asList("bar,bar", "null,barfoo", "foo,foo", "foobar,null"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testRightOuterJoin() throws Exception { final List<String> leftInput = Arrays.asList("foo", "foo", "foo", "bar","bar", "foobar", "foobar"); final List<String> rightInput = Arrays.asList("foo", "foo", "bar", "bar", "bar", "barfoo", "barfoo"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.RIGHT); List<String> expected = Arrays.asList("bar,bar", "bar,bar", "bar,bar", "bar,bar", "bar,bar", "bar,bar", "null,barfoo", "null,barfoo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foo,foo"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testFullOuterJoinBuildingCorrectCrossProducts() throws Exception { final List<String> leftInput = Arrays.asList("foo", "foo", "foo", "bar","bar", "foobar", "foobar"); final List<String> rightInput = Arrays.asList("foo", "foo", "bar", "bar", "bar", "barfoo", "barfoo"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL); List<String> expected = Arrays.asList("bar,bar", "bar,bar", "bar,bar", "bar,bar", "bar,bar", "bar,bar", "null,barfoo", "null,barfoo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foobar,null", "foobar,null"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testLeftOuterJoin() throws Exception { final List<String> leftInput = Arrays.asList("foo", "foo", "foo", "bar","bar", "foobar", "foobar"); final List<String> rightInput = Arrays.asList("foo", "foo", "bar", "bar", "bar", "barfoo", "barfoo"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.LEFT); List<String> expected = Arrays.asList("bar,bar", "bar,bar", "bar,bar", "bar,bar", "bar,bar", "bar,bar", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foo,foo", "foobar,null", "foobar,null"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testFullOuterJoinWithEmptyLeftInput() throws Exception { final List<String> leftInput = Collections.emptyList(); final List<String> rightInput = Arrays.asList("foo", "bar", "foobar"); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL); List<String> expected = Arrays.asList("null,bar", "null,foo", "null,foobar"); testOuterJoin(leftInput, rightInput, expected); }
@Test public void testFullOuterJoinWithEmptyRightInput() throws Exception { final List<String> leftInput = Arrays.asList("foo", "bar", "foobar"); final List<String> rightInput = Collections.emptyList(); baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL); List<String> expected = Arrays.asList("bar,null", "foo,null", "foobar,null"); testOuterJoin(leftInput, rightInput, expected); }