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


Java ValueComparator类代码示例

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


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

示例1: testSpillingFreesOnlyOverflowSegments

import org.apache.flink.api.java.typeutils.runtime.ValueComparator; //导入依赖的package包/类
/**
 * This tests the case where no additional partition buffers are used at the point when spilling
 * is triggered, testing that overflow bucket buffers are taken into account when deciding which
 * partition to spill.
 */
@Test
public void testSpillingFreesOnlyOverflowSegments() {
	final IOManager ioMan = new IOManagerAsync();
	
	final TypeSerializer<ByteValue> serializer = ByteValueSerializer.INSTANCE;
	final TypeComparator<ByteValue> buildComparator = new ValueComparator<>(true, ByteValue.class);
	final TypeComparator<ByteValue> probeComparator = new ValueComparator<>(true, ByteValue.class);
	
	@SuppressWarnings("unchecked")
	final TypePairComparator<ByteValue, ByteValue> pairComparator = Mockito.mock(TypePairComparator.class);
	
	try {
		final int pageSize = 32*1024;
		final int numSegments = 34;

		List<MemorySegment> memory = getMemory(numSegments, pageSize);

		MutableHashTable<ByteValue, ByteValue> table = new MutableHashTable<>(
				serializer, serializer, buildComparator, probeComparator,
				pairComparator, memory, ioMan, 1, false);

		table.open(new ByteValueIterator(100000000), new ByteValueIterator(1));
		
		table.close();
		
		checkNoTempFilesRemain(ioMan);
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
	finally {
		ioMan.shutdown();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:41,代码来源:HashTableTest.java

示例2: createComparator

import org.apache.flink.api.java.typeutils.runtime.ValueComparator; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public TypeComparator<T> createComparator(boolean sortOrderAscending) {
	if (!isKeyType()) {
		throw new RuntimeException("The type " + type.getName() + " is not Comparable.");
	}
	
	if (CopyableValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ValueComparator(sortOrderAscending, type);
	}
	else {
		return (TypeComparator<T>) new CopyableValueComparator(sortOrderAscending, type);
	}
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:15,代码来源:ValueTypeInfo.java

示例3: createComparator

import org.apache.flink.api.java.typeutils.runtime.ValueComparator; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@PublicEvolving
public TypeComparator<T> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	if (!isKeyType()) {
		throw new RuntimeException("The type " + type.getName() + " is not Comparable.");
	}

	if (BooleanValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new BooleanValueComparator(sortOrderAscending);
	}
	else if (ByteValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ByteValueComparator(sortOrderAscending);
	}
	else if (CharValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CharValueComparator(sortOrderAscending);
	}
	else if (DoubleValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new DoubleValueComparator(sortOrderAscending);
	}
	else if (FloatValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new FloatValueComparator(sortOrderAscending);
	}
	else if (IntValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new IntValueComparator(sortOrderAscending);
	}
	else if (LongValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new LongValueComparator(sortOrderAscending);
	}
	else if (NullValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) NullValueComparator.getInstance();
	}
	else if (ShortValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ShortValueComparator(sortOrderAscending);
	}
	else if (StringValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new StringValueComparator(sortOrderAscending);
	}
	else if (CopyableValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CopyableValueComparator(sortOrderAscending, type);
	}
	else {
		return (TypeComparator<T>) new ValueComparator(sortOrderAscending, type);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:46,代码来源:ValueTypeInfo.java

示例4: createComparator

import org.apache.flink.api.java.typeutils.runtime.ValueComparator; //导入依赖的package包/类
@Override
protected TypeComparator<StringValue> createComparator(boolean ascending) {
	return new ValueComparator<StringValue>(ascending, StringValue.class);
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:5,代码来源:ValueComparatorTest.java


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