**Describe the unexpected behaviour**
New `nonNegativeDerivative` window function fails with LOGICAL_ERROR.

**How to reproduce**

```
root@clickhouse1:/# clickhouse client
ClickHouse client version 22.6.1.1985 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.6.1 revision 54455.

clickhouse1 :) Bye.
root@clickhouse1:/# echo -e "SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id ASC) AS nnd FROM values('id Int8, metric Float32, ts DateTime64(0)', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:02')) FORMAT TabSeparatedWithNames" | clickhouse client -n 2>&1
Received exception from server (version 22.6.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Invalid number of rows in Chunk column Float32 position 3: expected 3, got 6. (LOGICAL_ERROR)
(query: SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id ASC) AS nnd FROM values('id Int8, metric Float32, ts DateTime64(0)', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:02')) FORMAT TabSeparatedWithNames
)
root@clickhouse1:/# 
```

**Which ClickHouse server version to use**
22.6.1.1985 (official build).

**Error message and/or stacktrace**
```
2022.06.28 15:45:36.627221 [ 9 ] {5552a5a1-7727-4ee2-a7ad-f06064384257} <Error> TCPHandler: Code: 49. DB::Exception: Invalid number of rows in Chunk column Float32 position 3: expected 3, got 6. (LOGICAL_ERROR), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xb8a147a in /usr/bin/clickhouse
1. DB::Chunk::checkNumRowsIsConsistent() @ 0x1718194e in /usr/bin/clickhouse
2. DB::WindowTransform::prepare() @ 0x173d497f in /usr/bin/clickhouse
3. DB::ExecutingGraph::updateNode(unsigned long, std::__1::queue<DB::ExecutingGraph::Node*, std::__1::deque<DB::ExecutingGraph::Node*, std::__1::allocator<DB::ExecutingGraph::Node*> > >&, std::__1::queue<DB::ExecutingGraph::Node*, std::__1::deque<DB::ExecutingGraph::Node*, std::__1::allocator<DB::ExecutingGraph::Node*> > >&) @ 0x171a9b59 in /usr/bin/clickhouse
4. DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x171a440b in /usr/bin/clickhouse
5. DB::PipelineExecutor::executeImpl(unsigned long) @ 0x171a3921 in /usr/bin/clickhouse
6. DB::PipelineExecutor::execute(unsigned long) @ 0x171a36b8 in /usr/bin/clickhouse
7. ? @ 0x171b38ce in /usr/bin/clickhouse
8. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xb94d0b7 in /usr/bin/clickhouse
9. ? @ 0xb9504dd in /usr/bin/clickhouse
10. ? @ 0x7f7cd5e02609 in ?
11. clone @ 0x7f7cd5d29293 in ?
```

if (ws.window_function_impl)
        {
            ws.window_function_impl->windowInsertResultInto(this, wi);
        }
        else
        {
            IColumn * result_column = block.output_columns[wi].get();
            const auto * a = ws.aggregate_function.get();
            auto * buf = ws.aggregate_function_state.data();
            
            
            if (a->isState())
            {
                
                auto * res_col_aggregate_function = typeid_cast<ColumnAggregateFunction *>(result_column);
                if (!res_col_aggregate_function)
                {
                    throw Exception("State function " + a->getName() + " inserts results into non-state column ",
                                    ErrorCodes::ILLEGAL_COLUMN);
                }
                res_col_aggregate_function->insertFrom(buf);
            }
            else
            {
                a->insertResultInto(buf, *result_column, arena.get());
            }
        }
    }
}
static void assertSameColumns(const Columns & left_all,