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

ranges.ranges = markRangesFromPKRange(part, metadata_snapshot, *key_condition, settings, log);
                else if (total_marks_count)
                    ranges.ranges = MarkRanges{MarkRange{0, total_marks_count}};
                sum_marks_pk.fetch_add(ranges.getMarksCount(), std::memory_order_relaxed);
                if (!ranges.ranges.empty())
                    sum_parts_pk.fetch_add(1, std::memory_order_relaxed);
                for (auto & index_and_condition : useful_indices)
                {
                    if (ranges.ranges.empty())
                        break;
                    index_and_condition.total_parts.fetch_add(1, std::memory_order_relaxed);
                    size_t total_granules = 0;
                    size_t granules_dropped = 0;
                    ranges.ranges = filterMarksUsingIndex(
                        index_and_condition.index,
                        index_and_condition.condition,
                        part,
                        ranges.ranges,
                        settings,
                        reader_settings,
                        total_granules,
                        granules_dropped,
                        log);
                    index_and_condition.total_granules.fetch_add(total_granules, std::memory_order_relaxed);
                    index_and_condition.granules_dropped.fetch_add(granules_dropped, std::memory_order_relaxed);
                    if (ranges.ranges.empty())
                        index_and_condition.parts_dropped.fetch_add(1, std::memory_order_relaxed);
                }
                if (!ranges.ranges.empty())
                {