protected void testGreatSmallAscDescWithReference(boolean ascending) { try { Tuple2<T[], R[]> data = getSortedData(); TypePairComparator<T, R> comparator = getComparator(ascending); //compares every element in high with every element in low for (int x = 0; x < data.f0.length - 1; x++) { for (int y = x + 1; y < data.f1.length; y++) { comparator.setReference(data.f0[x]); if (ascending) { assertTrue(comparator.compareToReference(data.f1[y]) > 0); } else { assertTrue(comparator.compareToReference(data.f1[y]) < 0); } } } } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); fail("Exception in test: " + e.getMessage()); } }
@Test public void testEqualityWithReference() { try { TypePairComparator<T, R> comparator = getComparator(true); Tuple2<T[], R[]> data = getSortedData(); for (int x = 0; x < data.f0.length; x++) { comparator.setReference(data.f0[x]); assertTrue(comparator.equalToReference(data.f1[x])); } } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); fail("Exception in test: " + e.getMessage()); } }
public HashBucketIterator<BT, PT> getMatchesFor(PT record) throws IOException { final TypeComparator<PT> probeAccessors = this.probeSideComparator; final int hash = hash(probeAccessors.hash(record), this.currentRecursionDepth); final int posHashCode = hash % this.numBuckets; // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> this.bucketsPerSegmentBits; final int bucketInSegmentOffset = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS; final MemorySegment bucket = this.buckets[bucketArrayPos]; // get the basic characteristics of the bucket final int partitionNumber = bucket.get(bucketInSegmentOffset + HEADER_PARTITION_OFFSET); final HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(partitionNumber); // for an in-memory partition, process set the return iterators, else spill the probe records if (p.isInMemory()) { this.recordComparator.setReference(record); this.bucketIterator.set(bucket, p.overflowSegments, p, hash, bucketInSegmentOffset); return this.bucketIterator; } else { throw new IllegalStateException("Method is not applicable to partially spilled hash tables."); } }
this.partition.setReadPosition(pointer); reuse = this.accessor.deserialize(reuse, this.partition); if (this.comparator.equalToReference(reuse)) { if (isBuildOuterJoin) { probedSet.set(numInSegment - 1);
public HashBucketIterator<BT, PT> getMatchesFor(PT record) throws IOException { final TypeComparator<PT> probeAccessors = this.probeSideComparator; final int hash = hash(probeAccessors.hash(record), this.currentRecursionDepth); final int posHashCode = hash % this.numBuckets; // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> this.bucketsPerSegmentBits; final int bucketInSegmentOffset = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS; final MemorySegment bucket = this.buckets[bucketArrayPos]; // get the basic characteristics of the bucket final int partitionNumber = bucket.get(bucketInSegmentOffset + HEADER_PARTITION_OFFSET); final HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(partitionNumber); // for an in-memory partition, process set the return iterators, else spill the probe records if (p.isInMemory()) { this.recordComparator.setReference(record); this.bucketIterator.set(bucket, p.overflowSegments, p, hash, bucketInSegmentOffset); return this.bucketIterator; } else { throw new IllegalStateException("Method is not applicable to partially spilled hash tables."); } }
this.partition.setReadPosition(pointer); reuse = this.accessor.deserialize(reuse, this.partition); if (this.comparator.equalToReference(reuse)) { if (isBuildOuterJoin) { probedSet.set(numInSegment - 1);
this.pairComparator.setReference(iterator1.getValues().getCurrent()); firstEmpty = false; final int comp = this.pairComparator.compareToReference(iterator2.getValues().getCurrent());
pairComparator.setReference(left); for (IN2 right : matchingHashes) { if (pairComparator.equalToReference(right)) { function.join(leftSerializer.copy(left), rightSerializer.copy(right), collector);
public HashBucketIterator<BT, PT> getMatchesFor(PT record) throws IOException { final TypeComparator<PT> probeAccessors = this.probeSideComparator; final int hash = hash(probeAccessors.hash(record), this.currentRecursionDepth); final int posHashCode = hash % this.numBuckets; // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> this.bucketsPerSegmentBits; final int bucketInSegmentOffset = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS; final MemorySegment bucket = this.buckets[bucketArrayPos]; // get the basic characteristics of the bucket final int partitionNumber = bucket.get(bucketInSegmentOffset + HEADER_PARTITION_OFFSET); final HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(partitionNumber); // for an in-memory partition, process set the return iterators, else spill the probe records if (p.isInMemory()) { this.recordComparator.setReference(record); this.bucketIterator.set(bucket, p.overflowSegments, p, hash, bucketInSegmentOffset); return this.bucketIterator; } else { throw new IllegalStateException("Method is not applicable to partially spilled hash tables."); } }
this.partition.setReadPosition(pointer); reuse = this.accessor.deserialize(reuse, this.partition); if (this.comparator.equalToReference(reuse)) { if (isBuildOuterJoin) { probedSet.set(numInSegment - 1);
} else { if (this.iterator1.nextKey()) { this.comp.setReference(this.iterator1.getCurrent()); firstEmpty = false; final int comp = this.comp.compareToReference(this.iterator2.getCurrent());
pairComparator.setReference(left); for (IN2 right : matchingHashes) { if (pairComparator.equalToReference(right)) { function.join(leftSerializer.copy(left), rightSerializer.copy(right), collector);
public HashBucketIterator<BT, PT> getMatchesFor(PT record) throws IOException { final TypeComparator<PT> probeAccessors = this.probeSideComparator; final int hash = hash(probeAccessors.hash(record), this.currentRecursionDepth); final int posHashCode = hash % this.numBuckets; // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> this.bucketsPerSegmentBits; final int bucketInSegmentOffset = (posHashCode & this.bucketsPerSegmentMask) << NUM_INTRA_BUCKET_BITS; final MemorySegment bucket = this.buckets[bucketArrayPos]; // get the basic characteristics of the bucket final int partitionNumber = bucket.get(bucketInSegmentOffset + HEADER_PARTITION_OFFSET); final HashPartition<BT, PT> p = this.partitionsBeingBuilt.get(partitionNumber); // for an in-memory partition, process set the return iterators, else spill the probe records if (p.isInMemory()) { this.recordComparator.setReference(record); this.bucketIterator.set(bucket, p.overflowSegments, p, hash, bucketInSegmentOffset); return this.bucketIterator; } else { throw new IllegalStateException("Method is not applicable to partially spilled hash tables."); } }
this.partition.setReadPosition(pointer); reuse = this.accessor.deserialize(reuse, this.partition); if (this.comparator.equalToReference(reuse)) { if (isBuildOuterJoin) { probedSet.set(numInSegment - 1);
} else { if (this.iterator1.nextKey()) { this.comp.setReference(this.iterator1.getCurrent()); firstEmpty = false; final int comp = this.comp.compareToReference(this.iterator2.getCurrent());
pairComparator.setReference(left); for (IN2 right : matchingHashes) { if (pairComparator.equalToReference(right)) { function.join(leftSerializer.copy(left), rightSerializer.copy(right), collector);
this.recordComparator.setReference(next); this.bucketIterator.set(bucket, p.overflowSegments, p, hash, bucketInSegmentOffset); return true;
this.partition.setReadPosition(pointer); BT result = this.accessor.deserialize(this.partition); if (this.comparator.equalToReference(result)) { if (isBuildOuterJoin) { probedSet.set(numInSegment - 1);
} else { if (this.iterator1.nextKey()) { this.comp.setReference(this.iterator1.getCurrent()); firstEmpty = false; final int comp = this.comp.compareToReference(this.iterator2.getCurrent());
this.recordComparator.setReference(next); this.bucketIterator.set(bucket, p.overflowSegments, p, hash, bucketInSegmentOffset); return true;