```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".

std::vector<RangesInDataParts::iterator> parts_to_merge_ranges;
    auto it = parts.begin();
    parts_to_merge_ranges.push_back(it);
    if (settings.do_not_merge_across_partitions_select_final)
    {
        while (it != parts.end())
        {
            it = std::find_if(
                it, parts.end(), [&it](auto & part) { return it->data_part->info.partition_id != part.data_part->info.partition_id; });
            parts_to_merge_ranges.push_back(it);
        }
        
        
        num_streams /= (parts_to_merge_ranges.size() - 1);
    }
    else
    {
        
        parts_to_merge_ranges.push_back(parts.end());
    }
    std::vector<QueryPlanPtr> partition_plans;
    
    
    std::vector<RangesInDataPart> lonely_parts;
    size_t total_rows_in_lonely_parts = 0;
    size_t sum_marks_in_lonely_parts = 0;