Skip to content

Cross join of subqueries does not support asterisks for complex queries #10481

@vladimir-golovchenko

Description

@vladimir-golovchenko

Cross join doesn't support asterisk for queries with more than two subqueries.

This query works:

SELECT *
FROM 
  (SELECT * from numbers(1)) AS n1,
  (SELECT * from numbers(2)) AS n2

This one failed:

SELECT *
FROM 
  (SELECT * from numbers(1)) AS n1,
  (SELECT * from numbers(2)) AS n2,
  (SELECT * from numbers(3)) AS n3

with error:

Received exception from server (version 20.3.8):
Code: 48. DB::Exception: Received from localhost:9000. DB::Exception: Multiple JOIN do not support asterisks for complex queries yet. Stack trace:

0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x10542450 in /usr/bin/clickhouse
1. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x8f4272d in /usr/bin/clickhouse
2. ? @ 0xd460741 in /usr/bin/clickhouse
3. ? @ 0xd45b1cc in /usr/bin/clickhouse
4. DB::JoinToSubqueryTransformMatcher::visit(DB::ASTSelectQuery&, std::__1::shared_ptr<DB::IAST>&, DB::JoinToSubqueryTransformMatcher::Data&) @ 0xd45bab6 in /usr/bin/clickhouse
5. DB::JoinToSubqueryTransformMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::JoinToSubqueryTransformMatcher::Data&) @ 0xd45e303 in /usr/bin/clickhouse
6. DB::InDepthNodeVisitor<DB::JoinToSubqueryTransformMatcher, true, std::__1::shared_ptr<DB::IAST> >::visit(std::__1::shared_ptr<DB::IAST>&) @ 0xd157eeb in /usr/bin/clickhouse
7. DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, DB::Context const&, std::__1::shared_ptr<DB::IBlockInputStream> const&, std::__1::optional<DB::Pipe>, std::__1::shared_ptr<DB::IStorage> const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) @ 0xd14a018 in /usr/bin/clickhouse
8. DB::InterpreterSelectQuery::InterpreterSelectQuery(std::__1::shared_ptr<DB::IAST> const&, DB::Context const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) @ 0xd14ab89 in /usr/bin/clickhouse
9. DB::InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(std::__1::shared_ptr<DB::IAST> const&, DB::Context const&, DB::SelectQueryOptions const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) @ 0xd34fcd6 in /usr/bin/clickhouse
10. DB::InterpreterFactory::get(std::__1::shared_ptr<DB::IAST>&, DB::Context&, DB::QueryProcessingStage::Enum) @ 0xd09efa4 in /usr/bin/clickhouse
11. ? @ 0xd55ee85 in /usr/bin/clickhouse
12. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, bool) @ 0xd561c71 in /usr/bin/clickhouse
13. DB::TCPHandler::runImpl() @ 0x9025489 in /usr/bin/clickhouse
14. DB::TCPHandler::run() @ 0x9026470 in /usr/bin/clickhouse
15. Poco::Net::TCPServerConnection::start() @ 0xe3b9a4b in /usr/bin/clickhouse
16. Poco::Net::TCPServerDispatcher::run() @ 0xe3b9ecd in /usr/bin/clickhouse
17. Poco::PooledThread::run() @ 0x105d05b7 in /usr/bin/clickhouse
18. Poco::ThreadImpl::runnableEntry(void*) @ 0x105cc3bc in /usr/bin/clickhouse
19. ? @ 0x105cdd5d in /usr/bin/clickhouse
20. start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so
21. __clone @ 0x12188f in /lib/x86_64-linux-gnu/libc-2.27.so

[CH 20.3.8.53]

Metadata

Metadata

Assignees

Labels

bugConfirmed user-visible misbehaviour in official releasecomp-joinsJOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions