use of org.apache.flink.table.runtime.operators.join.interval.PaddingRightMapFunction in project flink by apache.
the class StreamExecIntervalJoin method createNegativeWindowSizeJoin.
private Transformation<RowData> createNegativeWindowSizeJoin(JoinSpec joinSpec, Transformation<RowData> leftInputTransform, Transformation<RowData> rightInputTransform, int leftArity, int rightArity, InternalTypeInfo<RowData> returnTypeInfo, ReadableConfig config) {
// We filter all records instead of adding an empty source to preserve the watermarks.
FilterAllFlatMapFunction allFilter = new FilterAllFlatMapFunction(returnTypeInfo);
OuterJoinPaddingUtil paddingUtil = new OuterJoinPaddingUtil(leftArity, rightArity);
PaddingLeftMapFunction leftPadder = new PaddingLeftMapFunction(paddingUtil, returnTypeInfo);
PaddingRightMapFunction rightPadder = new PaddingRightMapFunction(paddingUtil, returnTypeInfo);
int leftParallelism = leftInputTransform.getParallelism();
int rightParallelism = rightInputTransform.getParallelism();
OneInputTransformation<RowData, RowData> filterAllLeftStream = new OneInputTransformation<>(leftInputTransform, "FilterLeft", new StreamFlatMap<>(allFilter), returnTypeInfo, leftParallelism);
filterAllLeftStream.setUid(createTransformationUid(FILTER_LEFT_TRANSFORMATION));
filterAllLeftStream.setDescription(createFormattedTransformationDescription("filter all left input transformation", config));
filterAllLeftStream.setName(createFormattedTransformationName(filterAllLeftStream.getDescription(), "FilterLeft", config));
OneInputTransformation<RowData, RowData> filterAllRightStream = new OneInputTransformation<>(rightInputTransform, "FilterRight", new StreamFlatMap<>(allFilter), returnTypeInfo, rightParallelism);
filterAllRightStream.setUid(createTransformationUid(FILTER_RIGHT_TRANSFORMATION));
filterAllRightStream.setDescription(createFormattedTransformationDescription("filter all right input transformation", config));
filterAllRightStream.setName(createFormattedTransformationName(filterAllRightStream.getDescription(), "FilterRight", config));
OneInputTransformation<RowData, RowData> padLeftStream = new OneInputTransformation<>(leftInputTransform, "PadLeft", new StreamMap<>(leftPadder), returnTypeInfo, leftParallelism);
padLeftStream.setUid(createTransformationUid(PAD_LEFT_TRANSFORMATION));
padLeftStream.setDescription(createFormattedTransformationDescription("pad left input transformation", config));
padLeftStream.setName(createFormattedTransformationName(padLeftStream.getDescription(), "PadLeft", config));
OneInputTransformation<RowData, RowData> padRightStream = new OneInputTransformation<>(rightInputTransform, "PadRight", new StreamMap<>(rightPadder), returnTypeInfo, rightParallelism);
padRightStream.setUid(createTransformationUid(PAD_RIGHT_TRANSFORMATION));
padRightStream.setDescription(createFormattedTransformationDescription("pad right input transformation", config));
padRightStream.setName(createFormattedTransformationName(padRightStream.getDescription(), "PadRight", config));
switch(joinSpec.getJoinType()) {
case INNER:
return new UnionTransformation<>(Lists.newArrayList(filterAllLeftStream, filterAllRightStream));
case LEFT:
return new UnionTransformation<>(Lists.newArrayList(padLeftStream, filterAllRightStream));
case RIGHT:
return new UnionTransformation<>(Lists.newArrayList(filterAllLeftStream, padRightStream));
case FULL:
return new UnionTransformation<>(Lists.newArrayList(padLeftStream, padRightStream));
default:
throw new TableException("should no reach here");
}
}
Aggregations