```sql
DROP TABLE IF EXISTS tp;

create table tp (d1 Int32, d2 Int32, eventcnt Int64,
projection p (select sum(eventcnt), d1 group by d1)) 
engine = SummingMergeTree order by (d1, d2);

set allow_experimental_projection_optimization = 1, force_optimize_projection = 1;

select sum(eventcnt) eventcnt, d1
from tp
group by d1;

DB::Exception: No projection is used when allow_experimental_projection_optimization = 1.

```

The exception message is also incorrect, should be "when force_optimize_projection = 1".

{
            parts_with_ranges = std::move(cache->parts_with_ranges);
            sum_marks = cache->sum_marks;
            sum_ranges = cache->sum_ranges;
        }
        else
        {
        
            cache->parts_with_ranges = std::move(parts_with_ranges);
            cache->sampling = std::move(sampling);
            cache->index_stats = std::move(index_stats);
            cache->sum_marks = sum_marks;
            cache->sum_ranges = sum_ranges;
            cache->use_cache = true;
            return std::make_unique<QueryPlan>();
        }
    }
    if (parts_with_ranges.empty())
        return std::make_unique<QueryPlan>();
    
    String query_id;
    {
        const auto data_settings = data.getSettings();
        auto max_partitions_to_read
                = settings.max_partitions_to_read.changed ? settings.max_partitions_to_read : data_settings->max_partitions_to_read;
        if (max_partitions_to_read > 0)
        {
            std::set<String> partitions;
            for (auto & part_with_ranges : parts_with_ranges)
                partitions.insert(part_with_ranges.data_part->info.partition_id);