**Describe the bug**
`SELECT i FROM generateRandom('i Array(Int8)', 1048575, 10, 1048577) LIMIT 1048575`

Memory limit should be respected.
catch (const DB::Exception & ex)
        {
            LOG_WARNING(storage.log, "Cannot parse default codec for part {} from file {}, content '{}', error '{}'. Default compression codec will be deduced automatically, from data on disk.", name, path, codec_line, ex.what());
            default_codec = detectDefaultCompressionCodec();
        }
    }
}
CompressionCodecPtr IMergeTreeDataPart::detectDefaultCompressionCodec() const
{
    
    if (!isStoredOnDisk())
        return CompressionCodecFactory::instance().get("NONE", {});
    auto metadata_snapshot = storage.getInMemoryMetadataPtr();
    const auto & storage_columns = metadata_snapshot->getColumns();
    CompressionCodecPtr result = nullptr;
    for (const auto & part_column : columns)
    {
        
        auto column_size = getColumnSize(part_column.name, *part_column.type);
        if (column_size.data_compressed != 0 && !storage_columns.hasCompressionCodec(part_column.name))
        {
            result = getCompressionCodecForFile(volume->getDisk(), getFullRelativePath() + getFileNameForColumn(part_column) + ".bin");
            break;
        }
    }
    if (!result)
        result = CompressionCodecFactory::instance().getDefaultCodec();
    return result;
}
void IMergeTreeDataPart::loadPartitionAndMinMaxIndex()