org.apache.flink.runtime.operators.hash.ReusingBuildSecondHashJoinIterator Java Examples
The following examples show how to use
org.apache.flink.runtime.operators.hash.ReusingBuildSecondHashJoinIterator.
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: HashVsSortMiniBenchmark.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testBuildSecond() { 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(); // compare with iterator values ReusingBuildSecondHashJoinIterator<Tuple2<Integer, String>, Tuple2<Integer, String>, Tuple2<Integer, String>> iterator = new ReusingBuildSecondHashJoinIterator<>( input1, input2, this.serializer1.getSerializer(), this.comparator1, this.serializer2.getSerializer(), this.comparator2, this.pairComparator11, this.memoryManager, this.ioManager, this.parentTask, 1, false, false, true); iterator.open(); while (iterator.callWithNextKey(matcher, collector)); iterator.close(); long elapsed = System.nanoTime() - start; double msecs = elapsed / (1000 * 1000); System.out.println("Hash Build Second took " + msecs + " msecs."); } catch (Exception e) { e.printStackTrace(); Assert.fail("An exception occurred during the test: " + e.getMessage()); } }
Example #2
Source File: HashVsSortMiniBenchmark.java From flink with Apache License 2.0 | 5 votes |
@Test public void testBuildSecond() { 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(); // compare with iterator values ReusingBuildSecondHashJoinIterator<Tuple2<Integer, String>, Tuple2<Integer, String>, Tuple2<Integer, String>> iterator = new ReusingBuildSecondHashJoinIterator<>( input1, input2, this.serializer1.getSerializer(), this.comparator1, this.serializer2.getSerializer(), this.comparator2, this.pairComparator11, this.memoryManager, this.ioManager, this.parentTask, 1, false, false, true); iterator.open(); while (iterator.callWithNextKey(matcher, collector)); iterator.close(); long elapsed = System.nanoTime() - start; double msecs = elapsed / (1000 * 1000); System.out.println("Hash Build Second took " + msecs + " msecs."); } catch (Exception e) { e.printStackTrace(); Assert.fail("An exception occurred during the test: " + e.getMessage()); } }
Example #3
Source File: HashVsSortMiniBenchmark.java From flink with Apache License 2.0 | 5 votes |
@Test public void testBuildSecond() { 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(); // compare with iterator values ReusingBuildSecondHashJoinIterator<Tuple2<Integer, String>, Tuple2<Integer, String>, Tuple2<Integer, String>> iterator = new ReusingBuildSecondHashJoinIterator<>( input1, input2, this.serializer1.getSerializer(), this.comparator1, this.serializer2.getSerializer(), this.comparator2, this.pairComparator11, this.memoryManager, this.ioManager, this.parentTask, 1, false, false, true); iterator.open(); while (iterator.callWithNextKey(matcher, collector)); iterator.close(); long elapsed = System.nanoTime() - start; double msecs = elapsed / (1000 * 1000); System.out.println("Hash Build Second took " + msecs + " msecs."); } catch (Exception e) { e.printStackTrace(); Assert.fail("An exception occurred during the test: " + e.getMessage()); } }
Example #4
Source File: LeftOuterJoinDriver.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case LEFT_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.LEFT, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case LEFT_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, false, true, false); case LEFT_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, false, false); default: throw new Exception("Unsupported driver strategy for left outer join driver: " + driverStrategy.name()); } }
Example #5
Source File: FullOuterJoinDriver.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case FULL_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.FULL, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case FULL_OUTER_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, true, false); case FULL_OUTER_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, true, false); default: throw new Exception("Unsupported driver strategy for full outer join driver: " + driverStrategy.name()); } }
Example #6
Source File: RightOuterJoinDriver.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case RIGHT_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.RIGHT, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case RIGHT_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, false, false); case RIGHT_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, false, true, false); default: throw new Exception("Unsupported driver strategy for right outer join driver: " + driverStrategy.name()); } }
Example #7
Source File: LeftOuterJoinDriver.java From flink with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case LEFT_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.LEFT, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case LEFT_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, false, true, false); case LEFT_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, false, false); default: throw new Exception("Unsupported driver strategy for left outer join driver: " + driverStrategy.name()); } }
Example #8
Source File: FullOuterJoinDriver.java From flink with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case FULL_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.FULL, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case FULL_OUTER_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, true, false); case FULL_OUTER_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, true, false); default: throw new Exception("Unsupported driver strategy for full outer join driver: " + driverStrategy.name()); } }
Example #9
Source File: RightOuterJoinDriver.java From flink with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case RIGHT_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.RIGHT, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case RIGHT_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, false, false); case RIGHT_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, false, true, false); default: throw new Exception("Unsupported driver strategy for right outer join driver: " + driverStrategy.name()); } }
Example #10
Source File: LeftOuterJoinDriver.java From flink with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case LEFT_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.LEFT, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case LEFT_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, false, true, false); case LEFT_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, false, false); default: throw new Exception("Unsupported driver strategy for left outer join driver: " + driverStrategy.name()); } }
Example #11
Source File: FullOuterJoinDriver.java From flink with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case FULL_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.FULL, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case FULL_OUTER_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, true, false); case FULL_OUTER_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, true, false); default: throw new Exception("Unsupported driver strategy for full outer join driver: " + driverStrategy.name()); } }
Example #12
Source File: RightOuterJoinDriver.java From flink with Apache License 2.0 | 4 votes |
@Override protected JoinTaskIterator<IT1, IT2, OT> getReusingOuterJoinIterator( DriverStrategy driverStrategy, MutableObjectIterator<IT1> in1, MutableObjectIterator<IT2> in2, TypeSerializer<IT1> serializer1, TypeComparator<IT1> comparator1, TypeSerializer<IT2> serializer2, TypeComparator<IT2> comparator2, TypePairComparatorFactory<IT1, IT2> pairComparatorFactory, MemoryManager memoryManager, IOManager ioManager, double driverMemFraction ) throws Exception { switch (driverStrategy) { case RIGHT_OUTER_MERGE: int numPages = memoryManager.computeNumberOfPages(driverMemFraction); return new ReusingMergeOuterJoinIterator<>( OuterJoinType.RIGHT, in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, numPages, super.taskContext.getContainingTask() ); case RIGHT_HYBRIDHASH_BUILD_FIRST: return new ReusingBuildFirstHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator21(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, true, false, false); case RIGHT_HYBRIDHASH_BUILD_SECOND: return new ReusingBuildSecondHashJoinIterator<>(in1, in2, serializer1, comparator1, serializer2, comparator2, pairComparatorFactory.createComparator12(comparator1, comparator2), memoryManager, ioManager, this.taskContext.getContainingTask(), driverMemFraction, false, true, false); default: throw new Exception("Unsupported driver strategy for right outer join driver: " + driverStrategy.name()); } }