processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/BufferArrayGrouper.java
/**
   * Computes required buffer capacity for a grouping key of the given cardinaltiy and aggregatorFactories.
   * This method assumes that the given cardinality doesn't count nulls.
   *
   * Returns -1 if cardinality + 1 (for null) > Integer.MAX_VALUE. Returns computed required buffer capacity
   * otherwise.
   */
Computes required buffer capacity for a grouping key of the given cardinaltiy and aggregatorFactories.
This method assumes that the given cardinality doesn't count nulls.

1 if cardinality + 1 (for null) > Integer.MAX_VALUE. Returns computed required buffer capacity
otherwise.
Computes required buffer capacity for a grouping key of the given cardinaltiy and aggregatorFactories . This method assumes that the given cardinality doesn ' t count nulls . 1 if cardinality + 1 ( for null ) > Integer . MAX_VALUE . Returns computed required buffer capacity otherwise .
static long requiredBufferCapacity(int cardinality, AggregatorFactory[] aggregatorFactories)
  {
    final long cardinalityWithMissingValue = computeCardinalityWithMissingValue(cardinality);
    if (cardinalityWithMissingValue > Integer.MAX_VALUE) {
      return -1;
    }
    final long recordSize = Arrays.stream(aggregatorFactories)
                                  .mapToLong(AggregatorFactory::getMaxIntermediateSizeWithNulls)
                                  .sum();
    return getUsedFlagBufferCapacity(cardinalityWithMissingValue) +  
           cardinalityWithMissingValue * recordSize;                 
  }
static long requiredBufferCapacity ( int cardinality , AggregatorFactory [ ] aggregatorFactories ) { final long cardinalityWithMissingValue = computeCardinalityWithMissingValue ( cardinality ) ; if ( cardinalityWithMissingValue > Integer . MAX_VALUE ) { return - 1 ; } final long recordSize = Arrays . stream ( aggregatorFactories ) . mapToLong ( AggregatorFactory :: getMaxIntermediateSizeWithNulls ) . sum ( ) ; return getUsedFlagBufferCapacity ( cardinalityWithMissingValue ) + cardinalityWithMissingValue * recordSize ; }
Computes required buffer capacity for a grouping key of the given cardinaltiy and aggregatorFactories.
Computes required buffer capacity for a grouping key of the given cardinaltiy and aggregatorFactories .
// Cardinality should be in the integer range. See DimensionDictionarySelector. // total used flags size // total values size