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

auto projection_step = std::make_unique<ExpressionStep>(plan->getCurrentDataStream(), result_projection);
        projection_step->setStepDescription("Remove unused columns after reading from storage");
        plan->addStep(std::move(projection_step));
    }
    
    if (sample_factor_column_queried)
    {
        ColumnWithTypeAndName column;
        column.name = "_sample_factor";
        column.type = std::make_shared<DataTypeFloat64>();
        column.column = column.type->createColumnConst(0, Field(used_sample_factor));
        auto adding_column_action = ActionsDAG::makeAddingColumnActions(std::move(column));
        auto adding_column = std::make_unique<ExpressionStep>(plan->getCurrentDataStream(), std::move(adding_column_action));
        adding_column->setStepDescription("Add _sample_factor column");
        plan->addStep(std::move(adding_column));
    }
    
    if (query_info.prewhere_info && query_info.prewhere_info->remove_columns_actions)
    {
        auto expression_step = std::make_unique<ExpressionStep>(
                plan->getCurrentDataStream(),
                query_info.prewhere_info->remove_columns_actions->getActionsDAG().clone());
        expression_step->setStepDescription("Remove unused columns after PREWHERE");
        plan->addStep(std::move(expression_step));
    }
    return plan;
}
namespace
{
size_t roundRowsOrBytesToMarks(