org.apache.flink.api.common.io.DefaultInputSplitAssigner Java Examples
The following examples show how to use
org.apache.flink.api.common.io.DefaultInputSplitAssigner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultSplitAssignerTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testSerialSplitAssignment() { try { final int NUM_SPLITS = 50; Set<InputSplit> splits = new HashSet<InputSplit>(); for (int i = 0; i < NUM_SPLITS; i++) { splits.add(new GenericInputSplit(i, NUM_SPLITS)); } DefaultInputSplitAssigner ia = new DefaultInputSplitAssigner(splits); InputSplit is = null; while ((is = ia.getNextInputSplit("", 0)) != null) { assertTrue(splits.remove(is)); } assertTrue(splits.isEmpty()); assertNull(ia.getNextInputSplit("", 0)); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
Example #2
Source File: DefaultSplitAssignerTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testSerialSplitAssignment() { try { final int NUM_SPLITS = 50; Set<InputSplit> splits = new HashSet<InputSplit>(); for (int i = 0; i < NUM_SPLITS; i++) { splits.add(new GenericInputSplit(i, NUM_SPLITS)); } DefaultInputSplitAssigner ia = new DefaultInputSplitAssigner(splits); InputSplit is = null; while ((is = ia.getNextInputSplit("", 0)) != null) { assertTrue(splits.remove(is)); } assertTrue(splits.isEmpty()); assertNull(ia.getNextInputSplit("", 0)); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
Example #3
Source File: DefaultSplitAssignerTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testSerialSplitAssignment() { try { final int NUM_SPLITS = 50; Set<InputSplit> splits = new HashSet<InputSplit>(); for (int i = 0; i < NUM_SPLITS; i++) { splits.add(new GenericInputSplit(i, NUM_SPLITS)); } DefaultInputSplitAssigner ia = new DefaultInputSplitAssigner(splits); InputSplit is = null; while ((is = ia.getNextInputSplit("", 0)) != null) { assertTrue(splits.remove(is)); } assertTrue(splits.isEmpty()); assertNull(ia.getNextInputSplit("", 0)); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
Example #4
Source File: AbstractParallelSourceBase.java From alibaba-flink-connectors with Apache License 2.0 | 5 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { if (!source.initInputSplitInMaster || source.disableParallelRead) { return new DefaultInputSplitAssigner(inputSplits); } else { return new PreAssignedInputSplitAssigner(inputSplits, taskInputSplitSize, taskInputSplitStartIndex); } }
Example #5
Source File: TypeExtractorInputFormatsTest.java From flink with Apache License 2.0 | 4 votes |
@Override public DefaultInputSplitAssigner getInputSplitAssigner(InputSplit[] splits) { return null; }
Example #6
Source File: GenericCsvInputFormat.java From Alink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(CsvFileInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #7
Source File: StanfordTweetsDataSetInputFormat.java From flink-examples with MIT License | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(TweetFileInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #8
Source File: FlinkPravegaInputFormat.java From flink-connectors with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(PravegaInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #9
Source File: SourceInputFormat.java From beam with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(final SourceInputSplit[] sourceInputSplits) { return new DefaultInputSplitAssigner(sourceInputSplits); }
Example #10
Source File: ImpulseInputFormat.java From beam with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(GenericInputSplit[] genericInputSplits) { return new DefaultInputSplitAssigner(genericInputSplits); }
Example #11
Source File: JdbcInputFormat.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #12
Source File: JdbcRowDataInputFormat.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #13
Source File: CassandraInputFormatBase.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #14
Source File: JobMasterTest.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(TestingInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #15
Source File: TypeExtractorInputFormatsTest.java From flink with Apache License 2.0 | 4 votes |
@Override public DefaultInputSplitAssigner getInputSplitAssigner(InputSplit[] splits) { return null; }
Example #16
Source File: NonRichGenericInputFormat.java From flink with Apache License 2.0 | 4 votes |
@Override public DefaultInputSplitAssigner getInputSplitAssigner(GenericInputSplit[] splits) { return new DefaultInputSplitAssigner(splits); }
Example #17
Source File: DefaultSplitAssignerTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testConcurrentSplitAssignment() { try { final int NUM_THREADS = 10; final int NUM_SPLITS = 500; final int SUM_OF_IDS = (NUM_SPLITS-1) * (NUM_SPLITS) / 2; Set<InputSplit> splits = new HashSet<InputSplit>(); for (int i = 0; i < NUM_SPLITS; i++) { splits.add(new GenericInputSplit(i, NUM_SPLITS)); } final DefaultInputSplitAssigner ia = new DefaultInputSplitAssigner(splits); final AtomicInteger splitsRetrieved = new AtomicInteger(0); final AtomicInteger sumOfIds = new AtomicInteger(0); Runnable retriever = new Runnable() { @Override public void run() { String host = ""; GenericInputSplit split; while ((split = (GenericInputSplit) ia.getNextInputSplit(host, 0)) != null) { splitsRetrieved.incrementAndGet(); sumOfIds.addAndGet(split.getSplitNumber()); } } }; // create the threads Thread[] threads = new Thread[NUM_THREADS]; for (int i = 0; i < NUM_THREADS; i++) { threads[i] = new Thread(retriever); threads[i].setDaemon(true); } // launch concurrently for (int i = 0; i < NUM_THREADS; i++) { threads[i].start(); } // sync for (int i = 0; i < NUM_THREADS; i++) { threads[i].join(5000); } // verify for (int i = 0; i < NUM_THREADS; i++) { if (threads[i].isAlive()) { fail("The concurrency test case is erroneous, the thread did not respond in time."); } } assertEquals(NUM_SPLITS, splitsRetrieved.get()); assertEquals(SUM_OF_IDS, sumOfIds.get()); // nothing left assertNull(ia.getNextInputSplit("", 0)); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
Example #18
Source File: OperatorStateInputFormat.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(OperatorStateInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #19
Source File: KeyedStateInputFormat.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(KeyGroupRangeInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #20
Source File: JobMasterTest.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(TestingInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #21
Source File: Generator.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(GenericInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #22
Source File: CassandraInputFormatBase.java From flink with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #23
Source File: CassandraInputFormatBase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #24
Source File: JDBCInputFormat.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #25
Source File: TypeExtractorInputFormatsTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public DefaultInputSplitAssigner getInputSplitAssigner(InputSplit[] splits) { return null; }
Example #26
Source File: TypeExtractorInputFormatsTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public DefaultInputSplitAssigner getInputSplitAssigner(InputSplit[] splits) { return null; }
Example #27
Source File: NonRichGenericInputFormat.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public DefaultInputSplitAssigner getInputSplitAssigner(GenericInputSplit[] splits) { return new DefaultInputSplitAssigner(splits); }
Example #28
Source File: DefaultSplitAssignerTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testConcurrentSplitAssignment() { try { final int NUM_THREADS = 10; final int NUM_SPLITS = 500; final int SUM_OF_IDS = (NUM_SPLITS-1) * (NUM_SPLITS) / 2; Set<InputSplit> splits = new HashSet<InputSplit>(); for (int i = 0; i < NUM_SPLITS; i++) { splits.add(new GenericInputSplit(i, NUM_SPLITS)); } final DefaultInputSplitAssigner ia = new DefaultInputSplitAssigner(splits); final AtomicInteger splitsRetrieved = new AtomicInteger(0); final AtomicInteger sumOfIds = new AtomicInteger(0); Runnable retriever = new Runnable() { @Override public void run() { String host = ""; GenericInputSplit split; while ((split = (GenericInputSplit) ia.getNextInputSplit(host, 0)) != null) { splitsRetrieved.incrementAndGet(); sumOfIds.addAndGet(split.getSplitNumber()); } } }; // create the threads Thread[] threads = new Thread[NUM_THREADS]; for (int i = 0; i < NUM_THREADS; i++) { threads[i] = new Thread(retriever); threads[i].setDaemon(true); } // launch concurrently for (int i = 0; i < NUM_THREADS; i++) { threads[i].start(); } // sync for (int i = 0; i < NUM_THREADS; i++) { threads[i].join(5000); } // verify for (int i = 0; i < NUM_THREADS; i++) { if (threads[i].isAlive()) { fail("The concurrency test case is erroneous, the thread did not respond in time."); } } assertEquals(NUM_SPLITS, splitsRetrieved.get()); assertEquals(SUM_OF_IDS, sumOfIds.get()); // nothing left assertNull(ia.getNextInputSplit("", 0)); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
Example #29
Source File: JobMasterTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(TestingInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }
Example #30
Source File: Generator.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public InputSplitAssigner getInputSplitAssigner(GenericInputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); }