Repository navigation
Closed
Closed
Copy link
Labels
Description
Describe the bug
Clickhouse fails to execute with a memory error when trying to parse it.
Does it reproduce on recent release?
Reproduces on v21.2.2.8, not on v21.1.2.15.
How to reproduce
Just enter the following query; don't need to create any tables:
WITH
(SELECT count(distinct colU) from tabA) AS withA,
(SELECT count(distinct colU) from tabA) AS withB
SELECT
withA / withB AS ratio
FROM
(
SELECT
date AS period,
colX
FROM
(
SELECT
date,
if(colA IN (SELECT colB FROM tabC), 0, colA) AS colX
FROM tabB
) AS tempB
GROUP BY period, colX
) AS mainResult with stack trace:
clickhouse_driver.errors.ServerException: Code: 241.
DB::Exception: Memory limit (for query) exceeded: would use 9.32 GiB (attempt to allocate chunk of 4194384 bytes), maximum: 9.31 GiB. Stack trace:
0. DB::Exception::Exception<char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*&&, char const*&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, long&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) @ 0x84eaa95 in /usr/bin/clickhouse
1. MemoryTracker::alloc(long) @ 0x84ea3ed in /usr/bin/clickhouse
2. MemoryTracker::alloc(long) @ 0x84ea154 in /usr/bin/clickhouse
3. DB::ASTSubquery::clone() const @ 0x1145b4a4 in /usr/bin/clickhouse
4. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
5. DB::ASTSelectQuery::clone() const @ 0x11448c9b in /usr/bin/clickhouse
6. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
7. DB::ASTSelectWithUnionQuery::clone() const @ 0x11451726 in /usr/bin/clickhouse
8. DB::ASTSubquery::clone() const @ 0x1145b691 in /usr/bin/clickhouse
9. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
10. DB::ASTSelectQuery::clone() const @ 0x11448c9b in /usr/bin/clickhouse
11. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
12. DB::ASTSelectWithUnionQuery::clone() const @ 0x11451726 in /usr/bin/clickhouse
13. DB::ASTSubquery::clone() const @ 0x1145b691 in /usr/bin/clickhouse
14. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
15. DB::ASTSelectQuery::clone() const @ 0x11448c9b in /usr/bin/clickhouse
16. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
17. DB::ASTSelectWithUnionQuery::clone() const @ 0x11451726 in /usr/bin/clickhouse
18. DB::ASTSubquery::clone() const @ 0x1145b691 in /usr/bin/clickhouse
19. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
20. DB::ASTSelectQuery::clone() const @ 0x11448c9b in /usr/bin/clickhouse
21. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
22. DB::ASTSelectWithUnionQuery::clone() const @ 0x11451726 in /usr/bin/clickhouse
23. DB::ASTSubquery::clone() const @ 0x1145b691 in /usr/bin/clickhouse
24. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
25. DB::ASTSelectQuery::clone() const @ 0x11448c9b in /usr/bin/clickhouse
26. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
27. DB::ASTSelectWithUnionQuery::clone() const @ 0x11451726 in /usr/bin/clickhouse
28. DB::ASTSubquery::clone() const @ 0x1145b691 in /usr/bin/clickhouse
29. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
30. DB::ASTSelectQuery::clone() const @ 0x11448c9b in /usr/bin/clickhouse
31. DB::ASTExpressionList::clone() const @ 0x1142dbc2 in /usr/bin/clickhouse
Activity
SaltTan commentedon Feb 12, 2021
Interesting
0 rows in set. Elapsed: 62.633 sec.
Received exception from server (version 21.2.2):
Code: 60. DB::Exception: Received from localhost:9000. DB::Exception: Table db.tabB doesn't exist.