MutableHashTable<Tuple2<Long, byte[]>, Long> table = new MutableHashTable<>( buildSerializer, probeSerializer, buildComparator, probeComparator, pairComparator, memory, ioMan, 16, false); table.open(buildInput, probeInput); while (table.nextRecord()) { MutableObjectIterator<Tuple2<Long, byte[]>> matches = table.getBuildSideIterator(); while (matches.next() != null) {} table.close();
/** * Initialize the hash table */ @Override public void open() { open(calcInitialNumBucketSegments()); }
/** * Opens the hash join. This method reads the build-side input and constructs the initial * hash table, gradually spilling partitions that do not fit into memory. * * @param buildSide Build side input. * @param probeSide Probe side input. * @throws IOException Thrown, if an I/O problem occurs while spilling a partition. */ public void open(final MutableObjectIterator<BT> buildSide, final MutableObjectIterator<PT> probeSide) throws IOException { open(buildSide, probeSide, false); }
private void init() { scanCount = -1; while (!moveToNextBucket()) { if (scanCount >= totalBucketNumber) { break; } } }
@Override public void abort() { this.running = false; this.hashJoin.abort(); } }
/** * Set new input for probe side * @throws IOException */ public void reopenProbe(MutableObjectIterator<V2> probeInput) throws IOException { reopenHashTable.reopenProbe(probeInput); } }
public PT getCurrentProbeRecord() { if (this.probeMatchedPhase) { return this.probeIterator.getCurrent(); } else { return null; } }
/** * Gets the number of memory segments used by this partition, which includes build side * memory buffers and overflow memory segments. * * @return The number of occupied memory segments. */ public int getNumOccupiedMemorySegments() { // either the number of memory segments, or one for spilling final int numPartitionBuffers = this.partitionBuffers != null ? this.partitionBuffers.length : this.buildSideWriteBuffer.getNumOccupiedMemorySegments(); return numPartitionBuffers + numOverflowSegments; }
/** * Returns an iterator that can be used to iterate over all the elements in the table. * WARNING: Doing any other operation on the table invalidates the iterator! (Even * using getMatchFor of a prober!) * @return the iterator */ @Override public EntryIterator getEntryIterator() { return new EntryIterator(); }
@Override protected void releaseTable() { if(furtherPartitioning || this.currentRecursionDepth > 0) { super.releaseTable(); } }
/** * @return number of memory segments in the smallest partition */ private int getMinPartition() { int minPartition = Integer.MAX_VALUE; for(InMemoryPartition<T> p1 : this.partitions) { if(p1.getBlockCount() < minPartition) { minPartition = p1.getBlockCount(); } } return minPartition; }
/** * This function reinitializes the bucket segments, * reads all records from the record segments (sequentially, without using the pointers or the buckets), * and rebuilds the hash table. */ private void rebuild() throws IOException { rebuild(bucketSegments.length); }
/** * Opens the hash join. This method reads the build-side input and constructs the initial * hash table, gradually spilling partitions that do not fit into memory. * * @param buildSide Build side input. * @param probeSide Probe side input. * @throws IOException Thrown, if an I/O problem occurs while spilling a partition. */ public void open(final MutableObjectIterator<BT> buildSide, final MutableObjectIterator<PT> probeSide) throws IOException { open(buildSide, probeSide, false); }
private void init() { scanCount = -1; while (!moveToNextBucket()) { if (scanCount >= totalBucketNumber) { break; } } }
@Override public void abort() { this.running = false; this.hashJoin.abort(); } }
/** * Set new input for probe side * @throws IOException */ public void reopenProbe(MutableObjectIterator<V1> probeInput) throws IOException { reopenHashTable.reopenProbe(probeInput); } }
private void init() { scanCount = -1; while (!moveToNextBucket()) { if (scanCount >= totalBucketNumber) { break; } } }
@Override public void abort() { this.running = false; this.hashJoin.abort(); } }