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

select_sample_offset->as<ASTSampleRatio &>().ratio.numerator,
                    select_sample_offset->as<ASTSampleRatio &>().ratio.denominator);
            if (relative_sample_offset < 0)
                throw Exception("Negative sample offset", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
            
            
            size_t approx_total_rows = 0;
            if (relative_sample_size > 1 || relative_sample_offset > 1)
                approx_total_rows = getApproximateTotalRowsToRead(parts, metadata_snapshot, *key_condition, settings); 
            if (relative_sample_size > 1)
            {
                relative_sample_size = convertAbsoluteSampleSizeToRelative(select_sample_size, approx_total_rows);
                LOG_DEBUG(log, "Selected relative sample size: {}", toString(relative_sample_size));
            }
            
            if (relative_sample_size == RelativeSize(1))
                relative_sample_size = 0;
            if (relative_sample_offset > 0 && RelativeSize(0) == relative_sample_size)
                throw Exception("Sampling offset is incorrect because no sampling", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
            if (relative_sample_offset > 1)
            {
                relative_sample_offset = convertAbsoluteSampleSizeToRelative(select_sample_offset, approx_total_rows);
                LOG_DEBUG(log, "Selected relative sample offset: {}", toString(relative_sample_offset));
            }
        }
        /** Which range of sampling key values do I need to read?
          * First, in the whole range ("universe") we select the interval
          *  of relative `relative_sample_size` size, offset from the beginning by `relative_sample_offset`.
          *
          * Example: SAMPLE 0.4 OFFSET 0.3