当前位置: 首页>>代码示例>>Java>>正文


Java UniformStringPairGenerator类代码示例

本文整理汇总了Java中org.apache.flink.runtime.operators.testutils.UniformStringPairGenerator的典型用法代码示例。如果您正苦于以下问题:Java UniformStringPairGenerator类的具体用法?Java UniformStringPairGenerator怎么用?Java UniformStringPairGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UniformStringPairGenerator类属于org.apache.flink.runtime.operators.testutils包,在下文中一共展示了UniformStringPairGenerator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testVariableLengthStringBuildAndRetrieve

import org.apache.flink.runtime.operators.testutils.UniformStringPairGenerator; //导入依赖的package包/类
@Test
public void testVariableLengthStringBuildAndRetrieve() throws IOException {
	final int NUM_MEM_PAGES = 40 * NUM_PAIRS / PAGE_SIZE;
	AbstractMutableHashTable<StringPair> table = getHashTable(serializerS, comparatorS, getMemory(NUM_MEM_PAGES));

	MutableObjectIterator<StringPair> buildInput = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

	MutableObjectIterator<StringPair> probeTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

	MutableObjectIterator<StringPair> updater = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

	MutableObjectIterator<StringPair> updateTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

	table.open();

	StringPair target = new StringPair();
	while(buildInput.next(target) != null) {
           table.insert(target);
       }

	AbstractHashTableProber<StringPair, StringPair> prober = table.getProber(comparatorS, pairComparatorS);
	StringPair temp = new StringPair();
	while(probeTester.next(target) != null) {
           assertNotNull("" + target.getKey(), prober.getMatchFor(target, temp));
           assertEquals(temp.getValue(), target.getValue());
       }

	while(updater.next(target) != null) {
           target.setValue(target.getValue());
           table.insertOrReplaceRecord(target);
       }

	while (updateTester.next(target) != null) {
           assertNotNull(prober.getMatchFor(target, temp));
           assertEquals(target.getValue(), temp.getValue());
       }

	table.close();
	assertEquals("Memory lost", NUM_MEM_PAGES, table.getFreeMemory().size());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:41,代码来源:MutableHashTableTestBase.java

示例2: testVariableLengthStringBuildAndRetrieve

import org.apache.flink.runtime.operators.testutils.UniformStringPairGenerator; //导入依赖的package包/类
@Test
public void testVariableLengthStringBuildAndRetrieve() {
	try {
		final int NUM_MEM_PAGES = 40 * NUM_PAIRS / PAGE_SIZE;
		
		MutableObjectIterator<StringPair> buildInput = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
		
		MutableObjectIterator<StringPair> probeTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
		
		MutableObjectIterator<StringPair> updater = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

		MutableObjectIterator<StringPair> updateTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
		
		AbstractMutableHashTable<StringPair> table = new CompactingHashTable<StringPair>(serializerS, comparatorS, getMemory(NUM_MEM_PAGES, PAGE_SIZE));
		table.open();
		
		StringPair target = new StringPair();
		while(buildInput.next(target) != null) {
			table.insert(target);
		}

		AbstractHashTableProber<StringPair, StringPair> prober = table.getProber(comparatorS, pairComparatorS);
		StringPair temp = new StringPair();
		while(probeTester.next(target) != null) {
			assertNotNull("" + target.getKey(), prober.getMatchFor(target, temp));
			assertEquals(temp.getValue(), target.getValue());
		}
		
		while(updater.next(target) != null) {
			target.setValue(target.getValue());
			table.insertOrReplaceRecord(target, temp);
		}
		
		while (updateTester.next(target) != null) {
			assertNotNull(prober.getMatchFor(target, temp));
			assertEquals(target.getValue(), temp.getValue());
		}
		
		table.close();
		assertEquals("Memory lost", NUM_MEM_PAGES, table.getFreeMemory().size());
	} catch (Exception e) {
		e.printStackTrace();
		fail("Error: " + e.getMessage());
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:46,代码来源:MemoryHashTableTest.java


注:本文中的org.apache.flink.runtime.operators.testutils.UniformStringPairGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。