```
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;
```
std::unordered_set<String> subdirs;
    for (const String & filename : filenames)
    {
        
        auto separator_pos = filename.rfind('/');
        if (separator_pos != String::npos)
        {
            String subdir = filename.substr(0, separator_pos);
            if (subdirs.emplace(subdir).second)
                disk->createDirectories(temp_part_dir / subdir);
        }
        
        if (filename.ends_with(IMergeTreeDataPart::TXN_VERSION_METADATA_FILE_NAME))
            continue;
        auto backup_entry = backup->readFile(part_path_in_backup_fs / filename);
        auto read_buffer = backup_entry->getReadBuffer();
        auto write_buffer = disk->writeFile(temp_part_dir / filename);
        copyData(*read_buffer, *write_buffer);
        write_buffer->finalize();
        reservation->update(reservation->getSize() - backup_entry->getSize());
    }
    auto single_disk_volume = std::make_shared<SingleDiskVolume>(disk->getName(), disk, 0);
    auto data_part_storage = std::make_shared<DataPartStorageOnDisk>(single_disk_volume, temp_part_dir.parent_path(), part_name);
    auto part = createPart(part_name, part_info, data_part_storage);
    part->version.setCreationTID(Tx::PrehistoricTID, nullptr);
    part->loadColumnsChecksumsIndexes(false, true);
    restored_parts_holder->addPart(part);
}
String MergeTreeData::getPartitionIDFromQuery(const ASTPtr & ast, ContextPtr local_context, DataPartsLock * acquired_lock) const