public List<TSDataType> buildTypes() {

    return Stream.concat(
            groupByOutputTypes.stream().map(InternalTypeManager::getTSDataType),
            groupedAggregators.stream().map(GroupedAggregator::getType))
        .collect(Collectors.toList());
  }
building hash sorted results requires memory for sorting group IDs. This method returns size of
that memory requirement.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/aggregation/grouped/builder/InMemoryHashAggregationBuilder.java