**Describe what's wrong**
Request with `DISTINCT`+`LIMIT BY`+`LIMIT` return less rows than provided in `LIMIT`

**Does it reproduce on recent release?**
22.11

**How to reproduce**
The following query from hits table returns less number of rows then provided in LIMIT
```
SELECT DISTINCT
    Title,
    SearchPhrase
FROM hits_v1
WHERE (SearchPhrase != '') AND (NOT match(Title, '[а-яА-ЯёЁ]')) AND (NOT match(SearchPhrase, '[а-яА-ЯёЁ]'))
LIMIT 1 BY
    Title,
    SearchPhrase
LIMIT 10
````
**Expected behavior**
Query returns number of rows provided in `LIMIT`

{
    auto & query = getSelectQuery();
    SortDescription output_order_descr = getSortDescription(query, context);
    UInt64 limit = getLimitForSorting(query, context);
    if (input_sorting_info)
    {
        /* Case of sorting with optimization using sorting key.
         * We have several threads, each of them reads batch of parts in direct
         *  or reverse order of sorting key using one input stream per part
         *  and then merge them into one sorted stream.
         * At this stage we merge per-thread streams into one.
         */
        executeOrderOptimized(query_plan, input_sorting_info, limit, output_order_descr);
        return;
    }
    const Settings & settings = context->getSettingsRef();
    SortingStep::Settings sort_settings(*context);
    
    auto sorting_step = std::make_unique<SortingStep>(
        query_plan.getCurrentDataStream(),
        output_order_descr,
        limit,
        sort_settings,
        settings.optimize_sorting_by_input_stream_properties);
    sorting_step->setStepDescription("Sorting for ORDER BY");
    query_plan.addStep(std::move(sorting_step));
}
void InterpreterSelectQuery::executeMergeSorted(QueryPlan & query_plan, const std::string & description)