@Override public void setInitialCapacity(int numRecords) { validityAllocationSizeInBytes = getValidityBufferSizeFromCount(numRecords); super.setInitialCapacity(numRecords); }
/** * Specialized version of setInitialCapacity() for ListVector. This is * used by some callers when they want to explicitly control and be * conservative about memory allocated for inner data vector. This is * very useful when we are working with memory constraints for a query * and have a fixed amount of memory reserved for the record batch. In * such cases, we are likely to face OOM or related problems when * we reserve memory for a record batch with value count x and * do setInitialCapacity(x) such that each vector allocates only * what is necessary and not the default amount but the multiplier * forces the memory requirement to go beyond what was needed. * * @param numRecords value count * @param density density of ListVector. Density is the average size of * list per position in the List vector. For example, a * density value of 10 implies each position in the list * vector has a list of 10 values. * A density value of 0.1 implies out of 10 positions in * the list vector, 1 position has a list of size 1 and * remaining positions are null (no lists) or empty lists. * This helps in tightly controlling the memory we provision * for inner data vector. */ @Override public void setInitialCapacity(int numRecords, double density) { validityAllocationSizeInBytes = getValidityBufferSizeFromCount(numRecords); super.setInitialCapacity(numRecords, density); }