Class AbstractBufferHashGrouper<KeyType>

    • Field Detail

      • log

        protected static final Logger log
      • bufferSupplier

        protected final com.google.common.base.Supplier<ByteBuffer> bufferSupplier
      • keySize

        protected final int keySize
      • baseAggregatorOffset

        protected final int baseAggregatorOffset
      • bufferGrouperMaxSize

        protected final int bufferGrouperMaxSize
      • maxLoadFactor

        protected float maxLoadFactor
      • initialBuckets

        protected int initialBuckets
      • bucketSize

        protected int bucketSize
      • hashTableBuffer

        protected ByteBuffer hashTableBuffer
    • Constructor Detail

    • Method Detail

      • newBucketHook

        public abstract void newBucketHook​(int bucketOffset)
        Called when a new bucket is used for an entry in the hash table. An implementing BufferHashGrouper class can use this to update its own state, e.g. tracking bucket offsets in a structure outside of the hash table.
        Parameters:
        bucketOffset - offset of the new bucket, within the buffer returned by hashTable.getTableBuffer()
      • canSkipAggregate

        public abstract boolean canSkipAggregate​(int bucketOffset)
        Called to check if it's possible to skip aggregation for a row.
        Parameters:
        bucketOffset - Offset of the bucket containing this row's entry in the hash table, within the buffer returned by hashTable.getTableBuffer()
        Returns:
        true if aggregation can be skipped, false otherwise.
      • afterAggregateHook

        public abstract void afterAggregateHook​(int bucketOffset)
        Called after a row is aggregated. An implementing BufferHashGrouper class can use this to update its own state, e.g. reading the new aggregated values for the row's key and acting on that information.
        Parameters:
        bucketOffset - Offset of the bucket containing the row that was aggregated, within the buffer returned by hashTable.getTableBuffer()
      • getGrowthCount

        public int getGrowthCount()
      • getSize

        public int getSize()
      • getBuckets

        public int getBuckets()
      • getMaxSize

        public int getMaxSize()
      • aggregate

        public AggregateResult aggregate​(KeyType key,
                                         int keyHash)
        Description copied from interface: Grouper
        Aggregate the current row with the provided key. Some implementations are thread-safe and some are not.
        Specified by:
        aggregate in interface Grouper<KeyType>
        Parameters:
        key - key object
        keyHash - result of Grouper.hashFunction() on the key
        Returns:
        result that is ok if the row was aggregated, not ok if a resource limit was hit