當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyFieldOutOfBoundsException類代碼示例

本文整理匯總了Java中org.apache.flink.types.KeyFieldOutOfBoundsException的典型用法代碼示例。如果您正苦於以下問題:Java KeyFieldOutOfBoundsException類的具體用法?Java KeyFieldOutOfBoundsException怎麽用?Java KeyFieldOutOfBoundsException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


KeyFieldOutOfBoundsException類屬於org.apache.flink.types包,在下文中一共展示了KeyFieldOutOfBoundsException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: compareToReference

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public int compareToReference(TypeComparator<T> referencedComparator) {
	TupleComparatorBase<T> other = (TupleComparatorBase<T>) referencedComparator;
	
	int i = 0;
	try {
		for (; i < this.keyPositions.length; i++) {
			@SuppressWarnings("unchecked")
			int cmp = this.comparators[i].compareToReference(other.comparators[i]);
			if (cmp != 0) {
				return cmp;
			}
		}
		return 0;
	}
	catch (NullPointerException npex) {
		throw new NullKeyFieldException(keyPositions[i]);
	}
	catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:TupleComparatorBase.java

示例2: hash

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public int hash(T value) {
	int i = 0;
	try {
		int code = this.comparators[0].hash(value.getFieldNotNull(keyPositions[0]));
		for (i = 1; i < this.keyPositions.length; i++) {
			code *= HASH_SALT[i & 0x1F]; // salt code with (i % HASH_SALT.length)-th salt component
			code += this.comparators[i].hash(value.getFieldNotNull(keyPositions[i]));
		}
		return code;
	}
	catch (NullFieldException nfex) {
		throw new NullKeyFieldException(nfex);
	}
	catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:TupleComparator.java

示例3: setReference

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void setReference(T toCompare) {
	int i = 0;
	try {
		for (; i < this.keyPositions.length; i++) {
			this.comparators[i].setReference(toCompare.getFieldNotNull(this.keyPositions[i]));
		}
	}
	catch (NullFieldException nfex) {
		throw new NullKeyFieldException(nfex);
	}
	catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:TupleComparator.java

示例4: equalToReference

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public boolean equalToReference(T candidate) {
	int i = 0;
	try {
		for (; i < this.keyPositions.length; i++) {
			if (!this.comparators[i].equalToReference(candidate.getFieldNotNull(this.keyPositions[i]))) {
				return false;
			}
		}
		return true;
	}
	catch (NullFieldException nfex) {
		throw new NullKeyFieldException(nfex);
	}
	catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:TupleComparator.java

示例5: compare

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public int compare(T first, T second) {
	int i = 0;
	try {
		for (; i < keyPositions.length; i++) {
			int keyPos = keyPositions[i];
			int cmp = comparators[i].compare(first.getFieldNotNull(keyPos), second.getFieldNotNull(keyPos));

			if (cmp != 0) {
				return cmp;
			}
		}
		return 0;
	} 
	catch (NullFieldException nfex) {
		throw new NullKeyFieldException(nfex);
	}
	catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:TupleComparator.java

示例6: hash

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public int hash(Row record) {
	int code = 0;
	int i = 0;

	try {
		for (; i < keyPositions.length; i++) {
			code *= TupleComparatorBase.HASH_SALT[i & 0x1F];
			Object element = record.getField(keyPositions[i]); // element can be null
			code += comparators[i].hash(element);
		}
	} catch (IndexOutOfBoundsException e) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}

	return code;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:RowComparator.java

示例7: equalToReference

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public boolean equalToReference(Row candidate) {
	int i = 0;
	try {
		for (; i < keyPositions.length; i++) {
			TypeComparator<Object> comparator = comparators[i];
			Object element = candidate.getField(keyPositions[i]);   // element can be null
			// check if reference is not equal
			if (!comparator.equalToReference(element)) {
				return false;
			}
		}
	} catch (IndexOutOfBoundsException e) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
	return true;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:RowComparator.java

示例8: compareToReference

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public int compareToReference(TypeComparator<Row> referencedComparator) {
	RowComparator other = (RowComparator) referencedComparator;
	int i = 0;
	try {
		for (; i < keyPositions.length; i++) {
			int cmp = comparators[i].compareToReference(other.comparators[i]);
			if (cmp != 0) {
				return cmp;
			}
		}
	} catch (IndexOutOfBoundsException e) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
	return 0;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:RowComparator.java

示例9: compare

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public int compare(Row first, Row second) {
	int i = 0;
	try {
		for (; i < keyPositions.length; i++) {
			int keyPos = keyPositions[i];
			TypeComparator<Object> comparator = comparators[i];
			Object firstElement = first.getField(keyPos);   // element can be null
			Object secondElement = second.getField(keyPos); // element can be null

			int cmp = comparator.compare(firstElement, secondElement);
			if (cmp != 0) {
				return cmp;
			}
		}
	} catch (IndexOutOfBoundsException e) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
	return 0;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:RowComparator.java

示例10: testMissingKey

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Test
public void testMissingKey() {
	// Test for IntValue
	@SuppressWarnings({"unchecked", "rawtypes"})
	final TypeComparator<Record> intComp = new RecordComparatorFactory(new int[] {1}, new Class[] {IntValue.class}).createComparator();
	final ChannelSelector<SerializationDelegate<Record>> oe1 = new OutputEmitter<Record>(ShipStrategyType.PARTITION_HASH, intComp);
	final SerializationDelegate<Record> delegate = new SerializationDelegate<Record>(new RecordSerializerFactory().getSerializer());
	
	Record rec = new Record(0);
	rec.setField(0, new IntValue(1));
	delegate.setInstance(rec);
	
	try {
		oe1.selectChannels(delegate, 100);
	} catch (KeyFieldOutOfBoundsException re) {
		Assert.assertEquals(1, re.getFieldNumber());
		return;
	}
	Assert.fail("Expected a KeyFieldOutOfBoundsException.");
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:OutputEmitterTest.java

示例11: hash

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public int hash(Record object) {
	int i = 0;
	try {
		int code = 0;
		for (; i < this.keyFields.length; i++) {
			code ^= object.getField(this.keyFields[i], this.transientKeyHolders[i]).hashCode();
			code *= HASH_SALT[i & 0x1F]; // salt code with (i % HASH_SALT.length)-th salt component
		}
		return code;
	}
	catch (NullPointerException npex) {
		throw new NullKeyFieldException(this.keyFields[i]);
	}
	catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(this.keyFields[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:RecordComparator.java

示例12: testMissingKey

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Test
public void testMissingKey() {
	// Test for IntValue
	@SuppressWarnings("unchecked")
	final RecordComparator intComp = new RecordComparator(new int[] {1}, new Class[] {IntValue.class});
	final ChannelSelector<Record> oe1 = new RecordOutputEmitter(ShipStrategyType.PARTITION_HASH, intComp);

	Record rec = new Record(0);
	rec.setField(0, new IntValue(1));
	
	try {
		oe1.selectChannels(rec, 100);
	} catch (KeyFieldOutOfBoundsException re) {
		Assert.assertEquals(1, re.getFieldNumber());
		return;
	}
	Assert.fail("Expected a KeyFieldOutOfBoundsException.");
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:19,代碼來源:RecordOutputEmitterTest.java

示例13: testMissingKey

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Test
public void testMissingKey() {
	// Test for IntValue
	@SuppressWarnings("unchecked")
	final TypeComparator<Record> intComp = new RecordComparatorFactory(new int[] {1}, new Class[] {IntValue.class}).createComparator();
	final ChannelSelector<SerializationDelegate<Record>> oe1 = new OutputEmitter<Record>(ShipStrategyType.PARTITION_HASH, intComp);
	final SerializationDelegate<Record> delegate = new SerializationDelegate<Record>(new RecordSerializerFactory().getSerializer());
	
	Record rec = new Record(0);
	rec.setField(0, new IntValue(1));
	delegate.setInstance(rec);
	
	try {
		oe1.selectChannels(delegate, 100);
	} catch (KeyFieldOutOfBoundsException re) {
		Assert.assertEquals(1, re.getFieldNumber());
		return;
	}
	Assert.fail("Expected a KeyFieldOutOfBoundsException.");
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:21,代碼來源:OutputEmitterTest.java

示例14: compareSerialized

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	if (deserializedFields1 == null) {
		instantiateDeserializationUtils();
	}
	
	int i = 0;
	try {
		for (; i < serializers.length; i++) {
			deserializedFields1[i] = serializers[i].deserialize(deserializedFields1[i], firstSource);
			deserializedFields2[i] = serializers[i].deserialize(deserializedFields2[i], secondSource);
		}
		
		for (i = 0; i < keyPositions.length; i++) {
			int keyPos = keyPositions[i];
			int cmp = comparators[i].compare(deserializedFields1[keyPos], deserializedFields2[keyPos]);
			if (cmp != 0) {
				return cmp;
			}
		}
		
		return 0;
	} catch (NullPointerException npex) {
		throw new NullKeyFieldException(keyPositions[i]);
	} catch (IndexOutOfBoundsException iobex) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i], iobex);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:30,代碼來源:TupleComparatorBase.java

示例15: setReference

import org.apache.flink.types.KeyFieldOutOfBoundsException; //導入依賴的package包/類
@Override
public void setReference(Row toCompare) {
	int i = 0;
	try {
		for (; i < keyPositions.length; i++) {
			TypeComparator<Object> comparator = comparators[i];
			Object element = toCompare.getField(keyPositions[i]);
			comparator.setReference(element);   // element can be null
		}
	} catch (IndexOutOfBoundsException e) {
		throw new KeyFieldOutOfBoundsException(keyPositions[i]);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:14,代碼來源:RowComparator.java


注:本文中的org.apache.flink.types.KeyFieldOutOfBoundsException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。