```
CREATE TABLE t (x UInt8, PROJECTION p (SELECT x GROUP BY x)) ENGINE = MergeTree ORDER BY ();
INSERT INTO t VALUES (0);

SET group_by_overflow_mode = 'any', max_rows_to_group_by = 1000, totals_mode = 'after_having_auto';
SELECT x FROM t GROUP BY x WITH TOTALS;
```
if (select_query->hasJoin())
        return std::nullopt;
    
    if (select_query->interpolate() && !select_query->interpolate()->children.empty())
        return std::nullopt;
    
    if (select_query->group_by_with_grouping_sets)
        return std::nullopt;
    auto query_options = SelectQueryOptions(
        QueryProcessingStage::WithMergeableState,
         1,
         true
    ).ignoreProjections().ignoreAlias();
    InterpreterSelectQuery select(
        query_ptr,
        query_context,
        query_options,
        query_info.prepared_sets);
    const auto & analysis_result = select.getAnalysisResult();
    query_info.prepared_sets = select.getQueryAnalyzer()->getPreparedSets();
    const auto & before_where = analysis_result.before_where;
    const auto & where_column_name = analysis_result.where_column_name;
    
    ActionDAGNodes added_filter_nodes;
    if (auto additional_filter_info = select.getAdditionalQueryInfo())
        added_filter_nodes.nodes.push_back(&additional_filter_info->actions->findInOutputs(additional_filter_info->column_name));
    if (before_where)