```
SELECT 1 FROM (select 1 a) A JOIN (select 1 b) B ON (arrayJoin([1]) = B.b)


2020.07.15 15:18:57.846463 [ 331717 ] {05d39ea9-f476-47e4-aff3-99398345ccc0} <Error> : Logical error: 'Continuation over multiple expressions is not supported'.
clickhouse-server: /home/akuzm/ch4/ch/src/Common/Exception.cpp:45: DB::Exception::Exception(const std::string &, int): Assertion `false' failed.
2020.07.15 15:18:57.846953 [ 331651 ] {} <Trace> BaseDaemon: Received signal 6
2020.07.15 15:18:57.847422 [ 331737 ] {} <Fatal> BaseDaemon: ########################################
2020.07.15 15:18:57.847989 [ 331737 ] {} <Fatal> BaseDaemon: (version 20.7.1.1, build id: F176DE2A5C050ABF) (from thread 331717) (query_id: 05d39ea9-f476-47e4-aff3-99398345ccc0) Received signal Aborted (6)
2020.07.15 15:18:57.848201 [ 331737 ] {} <Fatal> BaseDaemon: 
2020.07.15 15:18:57.848381 [ 331737 ] {} <Fatal> BaseDaemon: Stack trace: 0x7fe02e61518b 0x7fe02e5f4859 0x7fe02e5f4729 0x7fe02e605f36 0x7fe03253c3a5 0x7fe02190cf5c 0x7fe01d47b208 0x7fe021d691ab 0x7fe021d67c36 0x7fe021dd5378 0x7fe021dd55a6 0x7fe022102883 0x7fe02210187a 0x7fe01e68f874 0x7fe01e696dc8 0x7fe02f7ddd7c 0x7fe02f7de58a 0x7fe02f2ef173 0x7fe02f2ec03d 0x7fe02f2eaeba 0x7fe02e45b609 0x7fe02e6f1103
2020.07.15 15:18:57.848993 [ 331737 ] {} <Fatal> BaseDaemon: 4. /build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51: raise @ 0x4618b in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
2020.07.15 15:18:57.849230 [ 331737 ] {} <Fatal> BaseDaemon: 5. /build/glibc-YYA7BZ/glibc-2.31/stdlib/abort.c:81: __GI_abort @ 0x25859 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
2020.07.15 15:18:57.849508 [ 331737 ] {} <Fatal> BaseDaemon: 6. /build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:509: _nl_load_domain.cold @ 0x25729 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
2020.07.15 15:18:57.849782 [ 331737 ] {} <Fatal> BaseDaemon: 7. ? @ 0x36f36 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
2020.07.15 15:18:57.850100 [ 331737 ] {} <Fatal> BaseDaemon: 8. /home/akuzm/ch4/ch/src/Common/Exception.cpp:48: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x29c3a5 in /home/akuzm/ch4/build-clang10/src/libclickhouse_common_iod.so
2020.07.15 15:18:57.851087 [ 331737 ] {} <Fatal> BaseDaemon: 9. /home/akuzm/ch4/ch/src/Interpreters/ExpressionActions.cpp:691: DB::ExpressionActions::execute(DB::Block&, std::__1::shared_ptr<DB::ExtraBlock>&) const @ 0x11abf5c in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.851559 [ 331737 ] {} <Fatal> BaseDaemon: 10. /home/akuzm/ch4/ch/src/Processors/Transforms/InflatingExpressionTransform.cpp:11: DB::InflatingExpressionTransform::transformHeader(DB::Block, std::__1::shared_ptr<DB::ExpressionActions> const&) @ 0x270208 in /home/akuzm/ch4/build-clang10/src/libclickhouse_processors_transformsd.so
2020.07.15 15:18:57.853609 [ 331737 ] {} <Fatal> BaseDaemon: 11. /home/akuzm/ch4/ch/src/Interpreters/InterpreterSelectQuery.cpp:879: DB::InterpreterSelectQuery::executeImpl(DB::QueryPlan&, std::__1::shared_ptr<DB::IBlockInputStream> const&, std::__1::optional<DB::Pipe>) @ 0x16081ab in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.855667 [ 331737 ] {} <Fatal> BaseDaemon: 12. /home/akuzm/ch4/ch/src/Interpreters/InterpreterSelectQuery.cpp:472: DB::InterpreterSelectQuery::buildQueryPlan(DB::QueryPlan&) @ 0x1606c36 in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.857878 [ 331737 ] {} <Fatal> BaseDaemon: 13. /home/akuzm/ch4/ch/src/Interpreters/InterpreterSelectWithUnionQuery.cpp:183: DB::InterpreterSelectWithUnionQuery::buildQueryPlan(DB::QueryPlan&) @ 0x1674378 in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.860239 [ 331737 ] {} <Fatal> BaseDaemon: 14. /home/akuzm/ch4/ch/src/Interpreters/InterpreterSelectWithUnionQuery.cpp:198: DB::InterpreterSelectWithUnionQuery::execute() @ 0x16745a6 in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.863921 [ 331737 ] {} <Fatal> BaseDaemon: 15. /home/akuzm/ch4/ch/src/Interpreters/executeQuery.cpp:385: DB::executeQueryImpl(char const*, char const*, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, DB::ReadBuffer*) @ 0x19a1883 in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.867729 [ 331737 ] {} <Fatal> BaseDaemon: 16. /home/akuzm/ch4/ch/src/Interpreters/executeQuery.cpp:653: DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0x19a087a in /home/akuzm/ch4/build-clang10/src/libclickhouse_interpretersd.so
2020.07.15 15:18:57.868457 [ 331737 ] {} <Fatal> BaseDaemon: 17. /home/akuzm/ch4/ch/src/Server/TCPHandler.cpp:253: DB::TCPHandler::runImpl() @ 0x36a874 in /home/akuzm/ch4/build-clang10/src/libclickhouse_serverd.so
2020.07.15 15:18:57.869136 [ 331737 ] {} <Fatal> BaseDaemon: 18. /home/akuzm/ch4/ch/src/Server/TCPHandler.cpp:1210: DB::TCPHandler::run() @ 0x371dc8 in /home/akuzm/ch4/build-clang10/src/libclickhouse_serverd.so
2020.07.15 15:18:57.870074 [ 331737 ] {} <Fatal> BaseDaemon: 19. /home/akuzm/ch4/ch/contrib/poco/Net/src/TCPServerConnection.cpp:43: Poco::Net::TCPServerConnection::start() @ 0x1b9d7c in /home/akuzm/ch4/build-clang10/contrib/poco-cmake/Net/lib_poco_netd.so
2020.07.15 15:18:57.870916 [ 331737 ] {} <Fatal> BaseDaemon: 20. /home/akuzm/ch4/ch/contrib/poco/Net/src/TCPServerDispatcher.cpp:114: Poco::Net::TCPServerDispatcher::run() @ 0x1ba58a in /home/akuzm/ch4/build-clang10/contrib/poco-cmake/Net/lib_poco_netd.so
2020.07.15 15:18:57.871865 [ 331737 ] {} <Fatal> BaseDaemon: 21. /home/akuzm/ch4/ch/contrib/poco/Foundation/src/ThreadPool.cpp:199: Poco::PooledThread::run() @ 0x276173 in /home/akuzm/ch4/build-clang10/contrib/poco-cmake/Foundation/lib_poco_foundationd.so
2020.07.15 15:18:57.873069 [ 331737 ] {} <Fatal> BaseDaemon: 22. /home/akuzm/ch4/ch/contrib/poco/Foundation/src/Thread.cpp:56: Poco::(anonymous namespace)::RunnableHolder::run() @ 0x27303d in /home/akuzm/ch4/build-clang10/contrib/poco-cmake/Foundation/lib_poco_foundationd.so
2020.07.15 15:18:57.874004 [ 331737 ] {} <Fatal> BaseDaemon: 23. /home/akuzm/ch4/ch/contrib/poco/Foundation/src/Thread_POSIX.cpp:345: Poco::ThreadImpl::runnableEntry(void*) @ 0x271eba in /home/akuzm/ch4/build-clang10/contrib/poco-cmake/Foundation/lib_poco_foundationd.so
2020.07.15 15:18:57.874453 [ 331737 ] {} <Fatal> BaseDaemon: 24. start_thread @ 0x9609 in /lib/x86_64-linux-gnu/libpthread-2.31.so
2020.07.15 15:18:57.874958 [ 331737 ] {} <Fatal> BaseDaemon: 25. /build/glibc-YYA7BZ/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97: clone @ 0x122103 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
```
{
        if (auto * func = ast->as<ASTFunction>())
            visit(*func, ast, data);
    }
    static bool needChildVisit(const ASTPtr & node, const ASTPtr &)
    {
        if (auto * func = node->as<ASTFunction>())
            if (func->name == "equals")
                return false;
        return true;
    }
private:
    static void visit(const ASTFunction & func, const ASTPtr & ast, Data & data);
    static void getIdentifiers(const ASTPtr & ast, std::vector<const ASTIdentifier *> & out);
    static std::pair<size_t, size_t> getTableNumbers(const ASTPtr & expr, const ASTPtr & left_ast, const ASTPtr & right_ast, Data & data);
    static const ASTIdentifier * unrollAliases(const ASTIdentifier * identifier, const Aliases & aliases);
    static size_t getTableForIdentifiers(std::vector<const ASTIdentifier *> & identifiers, const Data & data);
    [[noreturn]] static void throwSyntaxException(const String & msg);
};
using CollectJoinOnKeysVisitor = CollectJoinOnKeysMatcher::Visitor;
}