当前位置: 首页>>代码示例>>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;未经允许,请勿转载。