**Describe the bug**

The query:
```
SELECT
    (current_database = currentDatabase()) AND (type = 0),
    ((current_database = currentDatabase()) AND (type = NULL)) AND (type = NULL) AND ((current_database = currentDatabase()) AND (type = 1048575)) AND (type = NULL) AND (event_date >= yesterday())
FROM system.query_log
ARRAY JOIN ProfileEvents
WHERE ProfileEvents AND (current_database = currentDatabase())
ORDER BY event_time DESC NULLS FIRST
LIMIT 0
```
crashes the server.

Most likely introduced here: #16618
auto interpreter = interpretSubquery(join_element.table_expression, context, original_right_columns, query_options);
            subquery_for_join.makeSource(interpreter, std::move(required_columns_with_aliases));
        }
        
        subquery_for_join.setJoinActions(joined_block_actions); 
        subquery_for_join.join = makeJoin(syntax->analyzed_join, subquery_for_join.sample_block, context);
        
        if (syntax->analyzed_join->dictionary_reader)
        {
            JoinPtr join = subquery_for_join.join;
            subqueries_for_sets.erase(join_subquery_id);
            return join;
        }
    }
    return subquery_for_join.join;
}
ActionsDAGPtr SelectQueryExpressionAnalyzer::appendPrewhere(
    ExpressionActionsChain & chain, bool only_types, const Names & additional_required_columns)
{
    const auto * select_query = getSelectQuery();
    ActionsDAGPtr prewhere_actions;
    if (!select_query->prewhere())
        return prewhere_actions;
    auto & step = chain.lastStep(sourceColumns());
    getRootActions(select_query->prewhere(), only_types, step.actions());
    String prewhere_column_name = select_query->prewhere()->getColumnName();
    step.required_output.push_back(prewhere_column_name);
    step.can_remove_required_output.push_back(true);
    auto filter_type = (*step.actions()->getIndex().find(prewhere_column_name))->result_type;
    if (!filter_type->canBeUsedInBooleanContext())