private void grow(long length) {
    // how many segments are required to get to the length?
    int requiredSegments = segment(length) + 1;

    // grow base array if necessary
    if (array.length < requiredSegments) {
      array = Arrays.copyOf(array, requiredSegments);
    }

    // add new segments
    while (segments < requiredSegments) {
      allocateNewSegment();
    }
  }
Copies this array, beginning at the specified sourceIndex, to the specified destinationIndex of
the destination array. A subsequence of this array's components are copied to the destination
array referenced by {@code destination}. The number of components copied is equal to the {@code
length} argument. The components at positions {@code sourceIndex} through {@code
sourceIndex+length-1} in this array are copied into positions {@code destinationIndex} through
{@code destinationIndex+length-1}, respectively, of the destination array.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/grouped/array/DoubleBigArray.java