Java Code Examples for org.apache.flink.runtime.operators.sort.UnilateralSortMerger#close()
The following examples show how to use
org.apache.flink.runtime.operators.sort.UnilateralSortMerger#close() .
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: DriverTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.shutdown(); Assert.assertTrue("I/O Manager has not properly shut down.", this.ioManager.isProperlyShutDown()); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 2
Source File: BinaryOperatorTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.shutdown(); Assert.assertTrue("I/O Manager has not properly shut down.", this.ioManager.isProperlyShutDown()); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 3
Source File: DriverTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 4
Source File: BinaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 5
Source File: DriverTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 6
Source File: BinaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
@After public void shutdownAll() throws Exception { // 1st, shutdown sorters for (UnilateralSortMerger<?> sorter : this.sorters) { if (sorter != null) { sorter.close(); } } this.sorters.clear(); // 2nd, shutdown I/O this.ioManager.close(); // last, verify all memory is returned and shutdown mem manager MemoryManager memMan = getMemoryManager(); if (memMan != null) { Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty()); memMan.shutdown(); } }
Example 7
Source File: HashVsSortMiniBenchmark.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testSortBothMerge() { try { TestData.TupleGenerator generator1 = new TestData.TupleGenerator(SEED1, INPUT_1_SIZE / 10, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH); TestData.TupleGenerator generator2 = new TestData.TupleGenerator(SEED2, INPUT_2_SIZE, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH); final TestData.TupleGeneratorIterator input1 = new TestData.TupleGeneratorIterator(generator1, INPUT_1_SIZE); final TestData.TupleGeneratorIterator input2 = new TestData.TupleGeneratorIterator(generator2, INPUT_2_SIZE); final FlatJoinFunction matcher = new NoOpMatcher(); final Collector<Tuple2<Integer, String>> collector = new DiscardingOutputCollector<>(); long start = System.nanoTime(); final UnilateralSortMerger<Tuple2<Integer, String>> sorter1 = new UnilateralSortMerger<>( this.memoryManager, this.ioManager, input1, this.parentTask, this.serializer1, this.comparator1.duplicate(), (double)MEMORY_FOR_SORTER/MEMORY_SIZE, 128, 0.8f, true /*use large record handler*/, true); final UnilateralSortMerger<Tuple2<Integer, String>> sorter2 = new UnilateralSortMerger<>( this.memoryManager, this.ioManager, input2, this.parentTask, this.serializer2, this.comparator2.duplicate(), (double)MEMORY_FOR_SORTER/MEMORY_SIZE, 128, 0.8f, true /*use large record handler*/, true); final MutableObjectIterator<Tuple2<Integer, String>> sortedInput1 = sorter1.getIterator(); final MutableObjectIterator<Tuple2<Integer, String>> sortedInput2 = sorter2.getIterator(); // compare with iterator values ReusingMergeInnerJoinIterator<Tuple2<Integer, String>, Tuple2<Integer, String>, Tuple2<Integer, String>> iterator = new ReusingMergeInnerJoinIterator<>(sortedInput1, sortedInput2, this.serializer1.getSerializer(), this.comparator1, this.serializer2.getSerializer(), this.comparator2, this.pairComparator11, this.memoryManager, this.ioManager, MEMORY_PAGES_FOR_MERGE, this.parentTask); iterator.open(); while (iterator.callWithNextKey(matcher, collector)); iterator.close(); sorter1.close(); sorter2.close(); long elapsed = System.nanoTime() - start; double msecs = elapsed / (1000 * 1000); System.out.println("Sort-Merge Took " + msecs + " msecs."); } catch (Exception e) { e.printStackTrace(); Assert.fail("An exception occurred during the test: " + e.getMessage()); } }
Example 8
Source File: HashVsSortMiniBenchmark.java From flink with Apache License 2.0 | 4 votes |
@Test public void testSortBothMerge() { try { TestData.TupleGenerator generator1 = new TestData.TupleGenerator(SEED1, INPUT_1_SIZE / 10, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH); TestData.TupleGenerator generator2 = new TestData.TupleGenerator(SEED2, INPUT_2_SIZE, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH); final TestData.TupleGeneratorIterator input1 = new TestData.TupleGeneratorIterator(generator1, INPUT_1_SIZE); final TestData.TupleGeneratorIterator input2 = new TestData.TupleGeneratorIterator(generator2, INPUT_2_SIZE); final FlatJoinFunction matcher = new NoOpMatcher(); final Collector<Tuple2<Integer, String>> collector = new DiscardingOutputCollector<>(); long start = System.nanoTime(); final UnilateralSortMerger<Tuple2<Integer, String>> sorter1 = new UnilateralSortMerger<>( this.memoryManager, this.ioManager, input1, this.parentTask, this.serializer1, this.comparator1.duplicate(), (double)MEMORY_FOR_SORTER/MEMORY_SIZE, 128, 0.8f, true /*use large record handler*/, true); final UnilateralSortMerger<Tuple2<Integer, String>> sorter2 = new UnilateralSortMerger<>( this.memoryManager, this.ioManager, input2, this.parentTask, this.serializer2, this.comparator2.duplicate(), (double)MEMORY_FOR_SORTER/MEMORY_SIZE, 128, 0.8f, true /*use large record handler*/, true); final MutableObjectIterator<Tuple2<Integer, String>> sortedInput1 = sorter1.getIterator(); final MutableObjectIterator<Tuple2<Integer, String>> sortedInput2 = sorter2.getIterator(); // compare with iterator values ReusingMergeInnerJoinIterator<Tuple2<Integer, String>, Tuple2<Integer, String>, Tuple2<Integer, String>> iterator = new ReusingMergeInnerJoinIterator<>(sortedInput1, sortedInput2, this.serializer1.getSerializer(), this.comparator1, this.serializer2.getSerializer(), this.comparator2, this.pairComparator11, this.memoryManager, this.ioManager, MEMORY_PAGES_FOR_MERGE, this.parentTask); iterator.open(); while (iterator.callWithNextKey(matcher, collector)); iterator.close(); sorter1.close(); sorter2.close(); long elapsed = System.nanoTime() - start; double msecs = elapsed / (1000 * 1000); System.out.println("Sort-Merge Took " + msecs + " msecs."); } catch (Exception e) { e.printStackTrace(); Assert.fail("An exception occurred during the test: " + e.getMessage()); } }
Example 9
Source File: HashVsSortMiniBenchmark.java From flink with Apache License 2.0 | 4 votes |
@Test public void testSortBothMerge() { try { TestData.TupleGenerator generator1 = new TestData.TupleGenerator(SEED1, INPUT_1_SIZE / 10, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH); TestData.TupleGenerator generator2 = new TestData.TupleGenerator(SEED2, INPUT_2_SIZE, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH); final TestData.TupleGeneratorIterator input1 = new TestData.TupleGeneratorIterator(generator1, INPUT_1_SIZE); final TestData.TupleGeneratorIterator input2 = new TestData.TupleGeneratorIterator(generator2, INPUT_2_SIZE); final FlatJoinFunction matcher = new NoOpMatcher(); final Collector<Tuple2<Integer, String>> collector = new DiscardingOutputCollector<>(); long start = System.nanoTime(); final UnilateralSortMerger<Tuple2<Integer, String>> sorter1 = new UnilateralSortMerger<>( this.memoryManager, this.ioManager, input1, this.parentTask, this.serializer1, this.comparator1.duplicate(), (double)MEMORY_FOR_SORTER/MEMORY_SIZE, 128, 0.8f, true /*use large record handler*/, true); final UnilateralSortMerger<Tuple2<Integer, String>> sorter2 = new UnilateralSortMerger<>( this.memoryManager, this.ioManager, input2, this.parentTask, this.serializer2, this.comparator2.duplicate(), (double)MEMORY_FOR_SORTER/MEMORY_SIZE, 128, 0.8f, true /*use large record handler*/, true); final MutableObjectIterator<Tuple2<Integer, String>> sortedInput1 = sorter1.getIterator(); final MutableObjectIterator<Tuple2<Integer, String>> sortedInput2 = sorter2.getIterator(); // compare with iterator values ReusingMergeInnerJoinIterator<Tuple2<Integer, String>, Tuple2<Integer, String>, Tuple2<Integer, String>> iterator = new ReusingMergeInnerJoinIterator<>(sortedInput1, sortedInput2, this.serializer1.getSerializer(), this.comparator1, this.serializer2.getSerializer(), this.comparator2, this.pairComparator11, this.memoryManager, this.ioManager, MEMORY_PAGES_FOR_MERGE, this.parentTask); iterator.open(); while (iterator.callWithNextKey(matcher, collector)); iterator.close(); sorter1.close(); sorter2.close(); long elapsed = System.nanoTime() - start; double msecs = elapsed / (1000 * 1000); System.out.println("Sort-Merge Took " + msecs + " msecs."); } catch (Exception e) { e.printStackTrace(); Assert.fail("An exception occurred during the test: " + e.getMessage()); } }