Search in sources :

Example 1 with StreamFormatAdapter

use of org.apache.flink.connector.file.src.impl.StreamFormatAdapter in project flink by apache.

the class LimitableBulkFormatTest method testSwallowExceptionWhenLimited.

@Test
public void testSwallowExceptionWhenLimited() throws IOException {
    long limit = 1000L;
    LimitableBulkFormat<String, FileSourceSplit> format = (LimitableBulkFormat<String, FileSourceSplit>) LimitableBulkFormat.create(new StreamFormatAdapter<>(new FailedFormat()), limit);
    BulkFormat.Reader<String> reader = format.createReader(new Configuration(), new FileSourceSplit("id", new Path(file.toURI()), 0, file.length()));
    format.globalNumberRead().set(limit + 1);
    // should swallow exception
    reader.readBatch();
}
Also used : Path(org.apache.flink.core.fs.Path) FileSourceSplit(org.apache.flink.connector.file.src.FileSourceSplit) Configuration(org.apache.flink.configuration.Configuration) StreamFormatAdapter(org.apache.flink.connector.file.src.impl.StreamFormatAdapter) BulkFormat(org.apache.flink.connector.file.src.reader.BulkFormat) Test(org.junit.Test)

Aggregations

Configuration (org.apache.flink.configuration.Configuration)1 FileSourceSplit (org.apache.flink.connector.file.src.FileSourceSplit)1 StreamFormatAdapter (org.apache.flink.connector.file.src.impl.StreamFormatAdapter)1 BulkFormat (org.apache.flink.connector.file.src.reader.BulkFormat)1 Path (org.apache.flink.core.fs.Path)1 Test (org.junit.Test)1