use of org.apache.flink.api.common.operators.base.OuterJoinOperatorBase.OuterJoinType in project flink by apache.
the class OuterJoinNode method getDataProperties.
private List<OperatorDescriptorDual> getDataProperties() {
OuterJoinOperatorBase<?, ?, ?, ?> operator = getOperator();
OuterJoinType type = operator.getOuterJoinType();
JoinHint joinHint = operator.getJoinHint();
joinHint = joinHint == null ? JoinHint.OPTIMIZER_CHOOSES : joinHint;
List<OperatorDescriptorDual> list;
switch(type) {
case LEFT:
list = createLeftOuterJoinDescriptors(joinHint);
break;
case RIGHT:
list = createRightOuterJoinDescriptors(joinHint);
break;
case FULL:
list = createFullOuterJoinDescriptors(joinHint);
break;
default:
throw new CompilerException("Unknown outer join type: " + type);
}
Partitioner<?> customPartitioner = operator.getCustomPartitioner();
if (customPartitioner != null) {
for (OperatorDescriptorDual desc : list) {
((AbstractJoinDescriptor) desc).setCustomPartitioner(customPartitioner);
}
}
return list;
}
use of org.apache.flink.api.common.operators.base.OuterJoinOperatorBase.OuterJoinType in project flink by apache.
the class AbstractSortMergeOuterJoinIteratorITCase method testFullOuterWithSample.
@SuppressWarnings("unchecked")
protected void testFullOuterWithSample() throws Exception {
CollectionIterator<Tuple2<String, String>> input1 = CollectionIterator.of(new Tuple2<>("Jack", "Engineering"), new Tuple2<>("Tim", "Sales"), new Tuple2<>("Zed", "HR"));
CollectionIterator<Tuple2<String, Integer>> input2 = CollectionIterator.of(new Tuple2<>("Allison", 100), new Tuple2<>("Jack", 200), new Tuple2<>("Zed", 150), new Tuple2<>("Zed", 250));
OuterJoinType outerJoinType = OuterJoinType.FULL;
List<Tuple4<String, String, String, Object>> actual = computeOuterJoin(input1, input2, outerJoinType);
List<Tuple4<String, String, String, Object>> expected = Arrays.asList(new Tuple4<String, String, String, Object>(null, null, "Allison", 100), new Tuple4<String, String, String, Object>("Jack", "Engineering", "Jack", 200), new Tuple4<String, String, String, Object>("Tim", "Sales", null, null), new Tuple4<String, String, String, Object>("Zed", "HR", "Zed", 150), new Tuple4<String, String, String, Object>("Zed", "HR", "Zed", 250));
Assert.assertEquals(expected, actual);
}
Aggregations