ClickHouse / ClickHouse/ClickHouse
max_ast_elements is not accounted when expending complexe direct dictionary dictGet.
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
When running query on a complexe direct dictionary if there is more than 40k lines in the block we recieve a `TOO_BIG_AST` exception.
Since it's a warning we can expect `max_ast_elements` or `max_expanded_ast_elements` to override the value.
But it's not the case since the exception clearly state that the maximum have not changed
```
Received exception from server (version 23.12.2):
Code: 168. DB::Exception: Received from localhost:9000. DB::Exception: AST is too big. Maximum: 50000: while executing 'FUNCTION dictGet('default.test_rocksDB_Complex' :: 1, 'B' :: 2, tuple(number) :: 3) -> dictGet('default.test_rocksDB_Complex', 'B', tuple(number)) String : 0'. (TOO_BIG_AST)
(query: SELECT dictGet('default.test_rocksDB_Complex', 'B', tuple(number))
FROM numbers(50000)
FORMAT `Null` SETTINGS max_expanded_ast_elements=2147483647;)
```
**How to reproduce**
Affected versiopn 21.6 to 23.12 ( so far )
Code to reproduce
```sql
create table rocksDB(A UInt64, B String)
Engine=MergeTree() order by A
as select number, toString(cityHash64(number))
from numbers(100000);
CREATE DICTIONARY test_rocksDB_Complex(A UInt64,B String)
PRIMARY KEY A
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 TABLE rocksDB DB 'default' USER 'default'))
LAYOUT(COMPLEX_KEY_DIRECT());
select now();
SELECT dictGet('default.test_rocksDB_Complex', 'B', tuple(number))
FROM numbers(50000)
FORMAT `Null` SETTINGS max_ast_elements=2147483647;
select now();
```
**Expected behavior**
Either this settings is used to change the limit.
But in a more general way if the except does not happen even without the settings it's even better.
[Liked to ](https://fiddle.clickhouse.com/734b6299-d04f-4b48-a4da-b1872a1db458)
#50662
Contributor guide
Assessment
This issue has not been assessed yet.