This window function does not work
```
select 
      sum(a)*100/sum(sum(a)) over
          (partition by b) as r
from 
(
  SELECT 1 as a, 2 as b
  UNION ALL
  SELECT 3 as a, 4 as b
  UNION ALL
  SELECT 5 as a, 2 as b

) as t
group by 
b
```

```
Received exception from server (version 22.7.1):
Code: 10. DB::Exception: Received from localhost:9000. DB::Exception: Not found column multiply(sum(a), 100) in block. Stack trace:

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xb8f1c3a in /usr/bin/clickhouse
1. DB::Exception::Exception<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(int, fmt::v8::basic_format_string<char, fmt::v8::type_identity<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::type>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xb95e638 in /usr/bin/clickhouse
2. DB::ActionsDAG::updateHeader(DB::Block) const @ 0x15a85d21 in /usr/bin/clickhouse
3. DB::ExpressionTransform::transformHeader(DB::Block, DB::ActionsDAG const&) @ 0x17401fc4 in /usr/bin/clickhouse
4. DB::ExpressionStep::ExpressionStep(DB::DataStream const&, std::__1::shared_ptr<DB::ActionsDAG>) @ 0x17507dc0 in /usr/bin/clickhouse
5. DB::InterpreterSelectQuery::executeExpression(DB::QueryPlan&, std::__1::shared_ptr<DB::ActionsDAG> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x162e1152 in /usr/bin/clickhouse
6. DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::optional<DB::Pipe>) @ 0x162d5d31 in /usr/bin/clickhouse
7. DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) @ 0x162d2f75 in /usr/bin/clickhouse
8. DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) @ 0x16317614 in /usr/bin/clickhouse
9. DB::InterpreterSelectWithUnionQuery::execute() @ 0x1631894d in /usr/bin/clickhouse
10. DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x165ecab2 in /usr/bin/clickhouse
11. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x165e9f75 in /usr/bin/clickhouse
12. DB::TCPHandler::runImpl() @ 0x171d3c5a in /usr/bin/clickhouse
13. DB::TCPHandler::run() @ 0x171e62d9 in /usr/bin/clickhouse
14. Poco::Net::TCPServerConnection::start() @ 0x19e85433 in /usr/bin/clickhouse
15. Poco::Net::TCPServerDispatcher::run() @ 0x19e867b1 in /usr/bin/clickhouse
16. Poco::PooledThread::run() @ 0x1a037b5b in /usr/bin/clickhouse
17. Poco::ThreadImpl::runnableEntry(void*) @ 0x1a035260 in /usr/bin/clickhouse
18. ? @ 0x7f5406b79609 in ?
19. clone @ 0x7f5406a9e163 in ?
. (NOT_FOUND_COLUMN_IN_BLOCK)

```



This works:
```
select 
      sum(a)/sum(sum(a)) over
          (partition by b) as r
from 
(
  SELECT 1 as a, 2 as b
  UNION ALL
  SELECT 3 as a, 4 as b
  UNION ALL
  SELECT 5 as a, 2 as b

) as t
group by 
b
```
struct ExpressionAnalysisResult
{
    std::string dump() const;
    
    bool first_stage = false;
    
    bool second_stage = false;
    bool need_aggregate = false;
    bool has_order_by   = false;
    bool has_window = false;
    String where_column_name;
    bool remove_where_filter = false;
    bool optimize_read_in_order = false;
    bool optimize_aggregation_in_order = false;
    bool join_has_delayed_stream = false;