```
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;
```
if (settings->in_memory_parts_enable_wal)
    {
        std::map<String, MutableDataPartsVector> disk_wal_part_map;
        std::mutex wal_init_lock;
        for (const auto & disk_ptr : disks)
        {
            if (disk_ptr->isBroken())
                continue;
            auto & disk_wal_parts = disk_wal_part_map[disk_ptr->getName()];
            pool.scheduleOrThrowOnError([&, disk_ptr]()
            {
                for (auto it = disk_ptr->iterateDirectory(relative_data_path); it->isValid(); it->next())
                {
                    if (!startsWith(it->name(), MergeTreeWriteAheadLog::WAL_FILE_NAME))
                        continue;
                    if (it->name() == MergeTreeWriteAheadLog::DEFAULT_WAL_FILE_NAME)
                    {
                        std::lock_guard lock(wal_init_lock);
                        if (write_ahead_log != nullptr)
                            throw Exception(
                                "There are multiple WAL files appeared in current storage policy. You need to resolve this manually",
                                ErrorCodes::CORRUPTED_DATA);
                        write_ahead_log = std::make_shared<MergeTreeWriteAheadLog>(*this, disk_ptr, it->name());
                        for (auto && part : write_ahead_log->restore(metadata_snapshot, getContext(), part_lock, is_static_storage))
                            disk_wal_parts.push_back(std::move(part));
                    }
                    else
                    {
                        MergeTreeWriteAheadLog wal(*this, disk_ptr, it->name());
                        for (auto && part : wal.restore(metadata_snapshot, getContext(), part_lock, is_static_storage))