Search in sources :

Example 11 with KeyFieldOutOfBoundsException

use of org.apache.flink.types.KeyFieldOutOfBoundsException in project flink by apache.

the class RecordComparator method hash.

// --------------------------------------------------------------------------------------------
@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();
            // salt code with (i % HASH_SALT.length)-th salt component
            code *= HASH_SALT[i & 0x1F];
        }
        return code;
    } catch (NullPointerException npex) {
        throw new NullKeyFieldException(this.keyFields[i]);
    } catch (IndexOutOfBoundsException iobex) {
        throw new KeyFieldOutOfBoundsException(this.keyFields[i]);
    }
}
Also used : KeyFieldOutOfBoundsException(org.apache.flink.types.KeyFieldOutOfBoundsException) NullKeyFieldException(org.apache.flink.types.NullKeyFieldException)

Aggregations

KeyFieldOutOfBoundsException (org.apache.flink.types.KeyFieldOutOfBoundsException)11 NullKeyFieldException (org.apache.flink.types.NullKeyFieldException)5 NullFieldException (org.apache.flink.types.NullFieldException)2 OutputEmitter (org.apache.flink.runtime.operators.shipping.OutputEmitter)1 SerializationDelegate (org.apache.flink.runtime.plugable.SerializationDelegate)1 RecordComparatorFactory (org.apache.flink.runtime.testutils.recordutils.RecordComparatorFactory)1 RecordSerializerFactory (org.apache.flink.runtime.testutils.recordutils.RecordSerializerFactory)1 IntValue (org.apache.flink.types.IntValue)1 Record (org.apache.flink.types.Record)1 Test (org.junit.Test)1