Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.api.common.io.InputFormat;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.functions.KeySelector;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStream;
Expand Down Expand Up @@ -253,7 +254,12 @@ private DataStream<MergeOnReadInputSplit> addFileDistributionStrategy(SingleOutp
} else if (OptionsResolver.isAppendMode(conf)) {
return source.partitionCustom(new StreamReadAppendPartitioner(conf.get(FlinkOptions.READ_TASKS)), new StreamReadAppendKeySelector());
} else {
return source.keyBy(MergeOnReadInputSplit::getFileId);
return source.keyBy(new KeySelector<MergeOnReadInputSplit, String>() {
@Override
public String getKey(MergeOnReadInputSplit split) throws Exception {
return split.getFileId();
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ public void testStopWithSavepointAndRestore() throws Exception {
public void testCheckpointRestoreWithLimit() throws Exception {
TestData.writeData(TestData.DATA_SET_INSERT, conf);
conf.set(FlinkOptions.READ_SPLITS_LIMIT, 2);
conf.set(FlinkOptions.READ_STREAMING_CHECK_INTERVAL, 1);
StreamReadMonitoringFunction function = TestUtils.getMonitorFunc(conf);
OperatorSubtaskState state;
try (AbstractStreamOperatorTestHarness<MergeOnReadInputSplit> harness = createHarness(function)) {
Expand All @@ -483,6 +482,7 @@ public void testCheckpointRestoreWithLimit() throws Exception {
assertTrue(sourceContext.splits.stream().allMatch(split -> split.getInstantRange().isPresent()),
"All instants should have range limit");
}
conf.set(FlinkOptions.READ_SPLITS_LIMIT, Integer.MAX_VALUE);
TestData.writeData(TestData.DATA_SET_UPDATE_INSERT, conf);
StreamReadMonitoringFunction function2 = TestUtils.getMonitorFunc(conf);
try (AbstractStreamOperatorTestHarness<MergeOnReadInputSplit> harness = createHarness(function2)) {
Expand Down
Loading