boolean appendRecordAndInsert ( BinaryRow record , int hashCode ) throws IOException { final int posHashCode = findBucket ( hashCode ) ; // get the bucket for the given hash code final int bucketArrayPos = posHashCode >> table . bucketsPerSegmentBits ; final int bucketInSegmentPos = ( posHashCode & table . bucketsPerSegmentMask ) << BUCKET_SIZE_BITS ; final MemorySegment bucket = this . buckets [ bucketArrayPos ] ; if ( ! table . tryDistinctBuildRow || ! partition . isInMemory ( ) || ! findFirstSameBuildRow ( bucket , hashCode , bucketInSegmentPos , record ) ) { int pointer = partition . insertIntoBuildBuffer ( record ) ; if ( pointer != - 1 ) { // record was inserted into an in-memory partition. a pointer must be inserted into the buckets insertToBucket ( bucket , bucketInSegmentPos , hashCode , pointer , true , true ) ; return true ; } else { return false ; } } else { // distinct build rows in memory. return true ; } }
Append record and insert to bucket .