use of org.apache.flink.streaming.api.operators.StreamOperator in project flink by apache.
the class String2SortMergeJoinOperatorTest method testInnerJoin.
@Test
public void testInnerJoin() throws Exception {
StreamOperator joinOperator = newOperator(FlinkJoinType.INNER, leftIsSmall);
TwoInputStreamTaskTestHarness<BinaryRowData, BinaryRowData, JoinedRowData> testHarness = buildSortMergeJoin(joinOperator);
ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
expectedOutput.add(new StreamRecord<>(newRow("a", "02")));
expectedOutput.add(new StreamRecord<>(newRow("b", "14")));
testHarness.waitForTaskCompletion();
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, transformToBinary(testHarness.getOutput()));
}
use of org.apache.flink.streaming.api.operators.StreamOperator in project flink by apache.
the class String2SortMergeJoinOperatorTest method testRightOuterJoin.
@Test
public void testRightOuterJoin() throws Exception {
StreamOperator joinOperator = newOperator(FlinkJoinType.RIGHT, leftIsSmall);
TwoInputStreamTaskTestHarness<BinaryRowData, BinaryRowData, JoinedRowData> testHarness = buildSortMergeJoin(joinOperator);
ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
expectedOutput.add(new StreamRecord<>(newRow("a", "02")));
expectedOutput.add(new StreamRecord<>(newRow("b", "14")));
expectedOutput.add(new StreamRecord<>(newRow("c", "2null")));
testHarness.waitForTaskCompletion();
TestHarnessUtil.assertOutputEquals("Output was not correct.", expectedOutput, transformToBinary(testHarness.getOutput()));
}
use of org.apache.flink.streaming.api.operators.StreamOperator in project flink by apache.
the class RandomSortMergeInnerJoinTest method test.
@Test
public void test() throws Exception {
final TupleGenerator generator1 = new TupleGenerator(SEED1, 500, 4096, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);
final TupleGenerator generator2 = new TupleGenerator(SEED2, 500, 2048, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);
final TestData.TupleGeneratorIterator input1 = new TestData.TupleGeneratorIterator(generator1, INPUT_FIRST_SIZE);
final TestData.TupleGeneratorIterator input2 = new TestData.TupleGeneratorIterator(generator2, INPUT_SECOND_SIZE);
// collect expected data
final Map<Integer, Collection<Match>> expectedMatchesMap = matchValues(collectData(input1), collectData(input2));
// reset the generators
generator1.reset();
generator2.reset();
input1.reset();
input2.reset();
StreamOperator operator = getOperator();
match(expectedMatchesMap, transformToBinary(join(operator, input1, input2)));
// assert that each expected match was seen
for (Map.Entry<Integer, Collection<Match>> entry : expectedMatchesMap.entrySet()) {
Assert.assertTrue("Collection for key " + entry.getKey() + " is not empty", entry.getValue().isEmpty());
}
}
Aggregations