Java Code Examples for org.apache.flink.runtime.operators.testutils.TestData#getIntIntTupleComparator()

The following examples show how to use org.apache.flink.runtime.operators.testutils.TestData#getIntIntTupleComparator() . 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: ReOpenableHashTableTestBase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
@Before
public void beforeTest() {
	this.recordSerializer = TestData.getIntStringTupleSerializer();

	this.record1Comparator = TestData.getIntStringTupleComparator();
	this.record2Comparator = TestData.getIntStringTupleComparator();
	this.recordPairComparator = new GenericPairComparator(this.record1Comparator, this.record2Comparator);

	this.recordBuildSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordProbeSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordBuildSideComparator = TestData.getIntIntTupleComparator();
	this.recordProbeSideComparator = TestData.getIntIntTupleComparator();
	this.pactRecordComparator = new GenericPairComparator(this.recordBuildSideComparator, this.recordProbeSideComparator);

	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1, PAGE_SIZE, MemoryType.HEAP, true);
	this.ioManager = new IOManagerAsync();
}
 
Example 2
Source File: ReOpenableHashTableTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
@Before
public void beforeTest() {
	this.recordSerializer = TestData.getIntStringTupleSerializer();

	this.record1Comparator = TestData.getIntStringTupleComparator();
	this.record2Comparator = TestData.getIntStringTupleComparator();
	this.recordPairComparator = new GenericPairComparator(this.record1Comparator, this.record2Comparator);

	this.recordBuildSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordProbeSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordBuildSideComparator = TestData.getIntIntTupleComparator();
	this.recordProbeSideComparator = TestData.getIntIntTupleComparator();
	this.pactRecordComparator = new GenericPairComparator(this.recordBuildSideComparator, this.recordProbeSideComparator);

	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1, PAGE_SIZE, MemoryType.HEAP, true);
	this.ioManager = new IOManagerAsync();
}
 
Example 3
Source File: ReOpenableHashTableTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
@Before
public void beforeTest() {
	this.recordSerializer = TestData.getIntStringTupleSerializer();

	this.record1Comparator = TestData.getIntStringTupleComparator();
	this.record2Comparator = TestData.getIntStringTupleComparator();
	this.recordPairComparator = new GenericPairComparator(this.record1Comparator, this.record2Comparator);

	this.recordBuildSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordProbeSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordBuildSideComparator = TestData.getIntIntTupleComparator();
	this.recordProbeSideComparator = TestData.getIntIntTupleComparator();
	this.pactRecordComparator = new GenericPairComparator(this.recordBuildSideComparator, this.recordProbeSideComparator);

	this.memoryManager = MemoryManagerBuilder
		.newBuilder()
		.setMemorySize(MEMORY_SIZE)
		.setPageSize(PAGE_SIZE)
		.build();
	this.ioManager = new IOManagerAsync();
}
 
Example 4
Source File: ReOpenableHashTableITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
@Before
public void beforeTest() {
	this.recordBuildSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordProbeSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordBuildSideComparator = TestData.getIntIntTupleComparator();
	this.recordProbeSideComparator = TestData.getIntIntTupleComparator();
	this.pactRecordComparator = new GenericPairComparator(this.recordBuildSideComparator, this.recordProbeSideComparator);

	this.memoryManager = MemoryManagerBuilder
		.newBuilder()
		.setMemorySize(MEMORY_SIZE)
		.setPageSize(PAGE_SIZE)
		.build();
	this.ioManager = new IOManagerAsync();
}
 
Example 5
Source File: ReOpenableHashTableITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
@Before
public void beforeTest() {
	this.recordBuildSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordProbeSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordBuildSideComparator = TestData.getIntIntTupleComparator();
	this.recordProbeSideComparator = TestData.getIntIntTupleComparator();
	this.pactRecordComparator = new GenericPairComparator(this.recordBuildSideComparator, this.recordProbeSideComparator);

	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1, PAGE_SIZE, MemoryType.HEAP, true);
	this.ioManager = new IOManagerAsync();
}
 
Example 6
Source File: CombiningUnilateralSortMergerITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1);
	this.ioManager = new IOManagerAsync();
	
	this.serializerFactory1 = TestData.getIntStringTupleSerializerFactory();
	this.comparator1 = TestData.getIntStringTupleComparator();

	this.serializerFactory2 = TestData.getIntIntTupleSerializerFactory();
	this.comparator2 = TestData.getIntIntTupleComparator();
}
 
Example 7
Source File: ReOpenableHashTableITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
@Before
public void beforeTest() {
	this.recordBuildSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordProbeSideAccesssor = TestData.getIntIntTupleSerializer();
	this.recordBuildSideComparator = TestData.getIntIntTupleComparator();
	this.recordProbeSideComparator = TestData.getIntIntTupleComparator();
	this.pactRecordComparator = new GenericPairComparator(this.recordBuildSideComparator, this.recordProbeSideComparator);

	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1, PAGE_SIZE, MemoryType.HEAP, true);
	this.ioManager = new IOManagerAsync();
}
 
Example 8
Source File: CombiningUnilateralSortMergerITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1);
	this.ioManager = new IOManagerAsync();
	
	this.serializerFactory1 = TestData.getIntStringTupleSerializerFactory();
	this.comparator1 = TestData.getIntStringTupleComparator();

	this.serializerFactory2 = TestData.getIntIntTupleSerializerFactory();
	this.comparator2 = TestData.getIntIntTupleComparator();
}
 
Example 9
Source File: CombiningUnilateralSortMergerITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
	this.memoryManager = MemoryManagerBuilder.newBuilder().setMemorySize(MEMORY_SIZE).build();
	this.ioManager = new IOManagerAsync();
	
	this.serializerFactory1 = TestData.getIntStringTupleSerializerFactory();
	this.comparator1 = TestData.getIntStringTupleComparator();

	this.serializerFactory2 = TestData.getIntIntTupleSerializerFactory();
	this.comparator2 = TestData.getIntIntTupleComparator();
}
 
Example 10
Source File: UnilateralSortMergerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testInMemorySorterDisposal() throws Exception {
	final TestingInMemorySorterFactory<Tuple2<Integer, Integer>> inMemorySorterFactory = new TestingInMemorySorterFactory<>();

	final int numPages = 32;
	final MemoryManager memoryManager = new MemoryManager(MemoryManager.DEFAULT_PAGE_SIZE * numPages, 1);
	final IOManagerAsync ioManager = new IOManagerAsync();
	final DummyInvokable parentTask = new DummyInvokable();

	try {
		final List<MemorySegment> memory = memoryManager.allocatePages(parentTask, numPages);
		final UnilateralSortMerger<Tuple2<Integer, Integer>> unilateralSortMerger = new UnilateralSortMerger<>(
			memoryManager,
			memory,
			ioManager,
			EmptyMutableObjectIterator.get(),
			parentTask,
			TestData.getIntIntTupleSerializerFactory(),
			TestData.getIntIntTupleComparator(),
			10,
			2,
			1.0f,
			true,
			false,
			false,
			inMemorySorterFactory);

		final Collection<TestingInMemorySorter<?>> inMemorySorters = inMemorySorterFactory.getInMemorySorters();

		assertThat(inMemorySorters, is(not(empty())));

		unilateralSortMerger.close();

		assertThat(unilateralSortMerger.closed, is(true));

		for (TestingInMemorySorter<?> inMemorySorter : inMemorySorters) {
			assertThat(inMemorySorter.isDisposed(), is(true));
		}
	} finally {
		ioManager.shutdown();
		memoryManager.shutdown();
	}
}
 
Example 11
Source File: UnilateralSortMergerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testInMemorySorterDisposal() throws Exception {
	final TestingInMemorySorterFactory<Tuple2<Integer, Integer>> inMemorySorterFactory = new TestingInMemorySorterFactory<>();

	final int numPages = 32;
	final MemoryManager memoryManager = new MemoryManager(MemoryManager.DEFAULT_PAGE_SIZE * numPages, 1);
	final DummyInvokable parentTask = new DummyInvokable();

	try (final IOManagerAsync ioManager = new IOManagerAsync()) {
		final List<MemorySegment> memory = memoryManager.allocatePages(parentTask, numPages);
		final UnilateralSortMerger<Tuple2<Integer, Integer>> unilateralSortMerger = new UnilateralSortMerger<>(
			memoryManager,
			memory,
			ioManager,
			EmptyMutableObjectIterator.get(),
			parentTask,
			TestData.getIntIntTupleSerializerFactory(),
			TestData.getIntIntTupleComparator(),
			10,
			2,
			1.0f,
			true,
			false,
			false,
			inMemorySorterFactory);

		final Collection<TestingInMemorySorter<?>> inMemorySorters = inMemorySorterFactory.getInMemorySorters();

		assertThat(inMemorySorters, is(not(empty())));

		unilateralSortMerger.close();

		assertThat(unilateralSortMerger.closed, is(true));

		for (TestingInMemorySorter<?> inMemorySorter : inMemorySorters) {
			assertThat(inMemorySorter.isDisposed(), is(true));
		}
	} finally {
		memoryManager.shutdown();
	}
}
 
Example 12
Source File: UnilateralSortMergerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testInMemorySorterDisposal() throws Exception {
	final TestingInMemorySorterFactory<Tuple2<Integer, Integer>> inMemorySorterFactory = new TestingInMemorySorterFactory<>();

	final int numPages = 32;
	final MemoryManager memoryManager = MemoryManagerBuilder
		.newBuilder()
		.setMemorySize(MemoryManager.DEFAULT_PAGE_SIZE * numPages)
		.build();
	final DummyInvokable parentTask = new DummyInvokable();

	try (final IOManagerAsync ioManager = new IOManagerAsync()) {
		final List<MemorySegment> memory = memoryManager.allocatePages(parentTask, numPages);
		final UnilateralSortMerger<Tuple2<Integer, Integer>> unilateralSortMerger = new UnilateralSortMerger<>(
			memoryManager,
			memory,
			ioManager,
			EmptyMutableObjectIterator.get(),
			parentTask,
			TestData.getIntIntTupleSerializerFactory(),
			TestData.getIntIntTupleComparator(),
			10,
			2,
			1.0f,
			true,
			false,
			false,
			inMemorySorterFactory);

		final Collection<TestingInMemorySorter<?>> inMemorySorters = inMemorySorterFactory.getInMemorySorters();

		assertThat(inMemorySorters, is(not(empty())));

		unilateralSortMerger.close();

		assertThat(unilateralSortMerger.closed, is(true));

		for (TestingInMemorySorter<?> inMemorySorter : inMemorySorters) {
			assertThat(inMemorySorter.isDisposed(), is(true));
		}
	} finally {
		memoryManager.shutdown();
	}
}