```
CREATE TABLE t (x UInt8, PROJECTION p (SELECT x GROUP BY x)) ENGINE = MergeTree ORDER BY ();
INSERT INTO t VALUES (0);

SET group_by_overflow_mode = 'any', max_rows_to_group_by = 1000, totals_mode = 'after_having_auto';
SELECT x FROM t GROUP BY x WITH TOTALS;
```
MergeTreePartInfo & new_part_info, const MergeTreePartition & partition, const String & new_part_name,
        const MergeTreeTransactionPtr & txn)
{
    auto metadata_snapshot = getInMemoryMetadataPtr();
    auto settings = getSettings();
    auto block = metadata_snapshot->getSampleBlock();
    NamesAndTypesList columns = metadata_snapshot->getColumns().getAllPhysical().filter(block.getNames());
    setAllObjectsToDummyTupleType(columns);
    auto minmax_idx = std::make_shared<IMergeTreeDataPart::MinMaxIndex>();
    minmax_idx->update(block, getMinMaxColumnsNames(metadata_snapshot->getPartitionKey()));
    DB::IMergeTreeDataPart::TTLInfos move_ttl_infos;
    VolumePtr volume = getStoragePolicy()->getVolume(0);
    ReservationPtr reservation = reserveSpacePreferringTTLRules(metadata_snapshot, 0, move_ttl_infos, time(nullptr), 0, true);
    VolumePtr data_part_volume = createVolumeFromReservation(reservation, volume);
    auto new_data_part_storage = std::make_shared<DataPartStorageOnDisk>(
        data_part_volume,
        getRelativeDataPath(),
        EMPTY_PART_TMP_PREFIX + new_part_name);
    auto new_data_part = createPart(