Abnormal memory requirements for a query with string filter


Appeared fresh after upgrade to 21.3.2.5 

The table is not big - 480 mb compressed

Getting an error
```
SQL Error [241]: ClickHouse exception, code: 241, host: localhost, port: 8123; Code: 241, e.displayText() = DB::Exception: Memory limit (for query) exceeded: would use 1.00 EiB (attempt to allocate chunk of 1152921504606554384 bytes), maximum: 101.47 GiB: While executing ConvertingAggregatedToChunksTransform (version 21.3.2.5 (official build))

The query is quite plain
SELECT 
       FirstScreen,
       "SessionResult" AS "SessionResult",
       count(*) AS count
FROM
  (SELECT FirstScreen,
          SessionResult,
          LastResponse,
          toDate(LastResponseDateTime),
          WasEligible,
          WasSessionSuccessfull,
          COUNT (*)
   FROM MPTUSSDSESSIONS
   GROUP by FirstScreen,
            SessionResult,
            LastResponse,
            toDate(LastResponseDateTime),
            WasEligible,
            WasSessionSuccessfull) AS expr_qry
WHERE  "SessionResult" NOT IN ('unknown result')
  AND "WasSessionSuccessfull" ='Y'
GROUP BY FirstScreen,  "SessionResult"
ORDER BY count DESC
LIMIT 10000;
```

Most interesting - when line  `AND "WasSessionSuccessfull" ='Y' ` is removed from the query it completes ok.
const auto & res_elem = result[result_col_num];
        Node * src_node = nullptr;
        Node * dst_node = nullptr;
        switch (mode)
        {
            case MatchColumnsMode::Position:
            {
                src_node = dst_node = actions_dag->inputs[result_col_num];
                break;
            }
            case MatchColumnsMode::Name:
            {
                auto & input = inputs[res_elem.name];
                if (input.empty())
                    throw Exception("Cannot find column " + backQuote(res_elem.name) + " in source stream",
                                    ErrorCodes::THERE_IS_NO_COLUMN);
                src_node = dst_node = actions_dag->inputs[input.front()];
                input.pop_front();
                break;
            }
        }
        
        if (const auto * res_const = typeid_cast<const ColumnConst *>(res_elem.column.get()))
        {
            if (const auto * src_const = typeid_cast<const ColumnConst *>(dst_node->column.get()))
            {
                if (ignore_constant_values)
                    dst_node = const_cast<Node *>(&actions_dag->addColumn(res_elem, true));
                else if (res_const->getField() != src_const->getField())
                    throw Exception("Cannot convert column " + backQuote(res_elem.name) + " because "