ClickHouse / ClickHouse/ClickHouse
Unexpected result: dictionary with not nullable attribute + OrDefault Null
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
```sql
create table price (key UInt64, price Float64) Engine=Memory
as
select 1, 100;
CREATE DICTIONARY test( key Int64, price Float64 default 0)
PRIMARY KEY key
SOURCE(Clickhouse(table price))
LIFETIME(0)
LAYOUT(Flat);
select key,
dictGetFloat64('test', 'price', key ) A,
dictGetFloat64OrDefault('test', 'price', key, 999) B,
dictGetFloat64OrDefault('test', 'price', key, Null) C
from (select arrayJoin([1,2]) key)
format PrettyCompactMonoBlock;
┌─key─┬───A─┬───B─┬─C────┐
│ 1 │ 100 │ 100 │ ᴺᵁᴸᴸ │ -- expected 100
│ 2 │ 0 │ 999 │ ᴺᵁᴸᴸ │
└─────┴─────┴─────┴──────┘
```
https://fiddle.clickhouse.com/188a3143-d0d3-4d15-ab38-3cda22f81509
also unexpected:
```
select key,
dictGetOrDefault('test', 'price', key, Null) C
from (select arrayJoin([1,2]) key)
format PrettyCompactMonoBlock;
DB::Exception: Cannot convert NULL to a non-nullable type: while executing
CANNOT_CONVERT_TYPE
```
Contributor guide
Assessment
This issue has not been assessed yet.