當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。