@Override public int hash(T record) { if (record != null) { return wrappedComparator.hash(record); } else { return 0; } }
public TypeComparable(T elem, TypeComparator<T> comparator) { this.elem = elem; this.comparator = comparator; this.hashCode = comparator.hash(elem); }
@Override public int hash(T value) { int i = 0; int code = 0; for (; i < this.keyFields.length; i++) { code *= TupleComparatorBase.HASH_SALT[i & 0x1F]; try { code += this.comparators[i].hash(accessField(keyFields[i], value)); }catch(NullPointerException npe) { throw new RuntimeException("A NullPointerException occured while accessing a key field in a POJO. " + "Most likely, the value grouped/joined on is null. Field name: "+keyFields[i].getName(), npe); } } return code; }
@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]); } }
@SuppressWarnings("unchecked") public void insertOrReplace(BT record) { int hashCode = hash(buildComparator.hash(record)); int index = hashIndex(hashCode, data.length); buildComparator.setReference(record); HashEntry entry = data[index]; while (entry != null) { if (entryHashCode(entry) == hashCode && buildComparator.equalToReference((BT) entry.getValue())) { entry.setValue(record); return; } entry = entryNext(entry); } addMapping(index, hashCode, null, record); }
int pHash = pojoComp.hash(pojoTestRecord); TypeComparator<Tuple1<String>> tupleComp = tType.createComparator(new int[] {0}, new boolean[] {true}, 0, new ExecutionConfig()); int tHash = tupleComp.hash(tupleTest); int multiPojoHash = multiPojoComp.hash(pojoTestRecord); int multiTupleHash = multiTupleComp.hash(multiTupleTest);
public TypeComparable(T elem, TypeComparator<T> comparator) { this.elem = elem; this.comparator = comparator; this.hashCode = comparator.hash(elem); }
public TypeComparable(T elem, TypeComparator<T> comparator) { this.elem = elem; this.comparator = comparator; this.hashCode = comparator.hash(elem); }
@Override public int hash(T record) { if (record != null) { return wrappedComparator.hash(record); } else { return 0; } }
@Override public int hash(T record) { if (record != null) { return wrappedComparator.hash(record); } else { return 0; } }
@Override public int hash(T t) { return (t == null) ? 1 : this.wrappedComparator.hash(t); }
@SuppressWarnings("unchecked") @Override public int hash(Tuple value) { int code = this.comparators[0].hash(value.getObject(keyPositions[0])); for (int 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.getObject(keyPositions[i])); } return code; }
private int[] hashPartitionDefault(T record, int numberOfChannels) { int hash = this.comparator.hash(record); this.channels[0] = MathUtils.murmurHash(hash) % numberOfChannels; return this.channels; }
private int[] hashPartitionDefault(T record, int numberOfChannels) { int hash = this.comparator.hash(record); this.channels[0] = MathUtils.murmurHash(hash) % numberOfChannels; return this.channels; }
private int[] hashPartitionDefault(T record, int numberOfChannels) { int hash = this.comparator.hash(record); this.channels[0] = MathUtils.murmurHash(hash) % numberOfChannels; return this.channels; }
private int hashPartitionDefault(T record, int numberOfChannels) { int hash = this.comparator.hash(record); return MathUtils.murmurHash(hash) % numberOfChannels; }
@SuppressWarnings("unchecked") @Override public int hash(Tuple value) { if(!areKeysAbs) { makeKeysAbs(keyPositions, value.size()); areKeysAbs = true; } int code = this.comparators[0].hash(value.getObject(keyPositions[0])); for (int 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.getObject(keyPositions[i])); } return code; }
@SuppressWarnings("unchecked") public void insertOrReplace(BT record) { int hashCode = hash(buildComparator.hash(record)); int index = hashIndex(hashCode, data.length); buildComparator.setReference(record); HashEntry entry = data[index]; while (entry != null) { if (entryHashCode(entry) == hashCode && buildComparator.equalToReference((BT) entry.getValue())) { entry.setValue(record); return; } entry = entryNext(entry); } addMapping(index, hashCode, null, record); }
@SuppressWarnings("unchecked") public void insertOrReplace(BT record) { int hashCode = hash(buildComparator.hash(record)); int index = hashIndex(hashCode, data.length); buildComparator.setReference(record); HashEntry entry = data[index]; while (entry != null) { if (entryHashCode(entry) == hashCode && buildComparator.equalToReference((BT) entry.getValue())) { entry.setValue(record); return; } entry = entryNext(entry); } addMapping(index, hashCode, null, record); }