Search in sources :

Example 11 with NullKeyFieldException

use of org.apache.flink.types.NullKeyFieldException 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
            code *= HASH_SALT[i & 0x1F];
        // component
        }
        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

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