Skip to content
Advertisement

Clickhouse, create dictionary with decimal type

I try to create a clickhouse dictionary:

CREATE DICTIONARY rnd.exchange_rate_history (
    code String,
    date Date,
    rate Decimal(20, 6)
)
PRIMARY KEY code, date...

But I get an error:

Unknown type Decimal(20, 6) (version 20.6.3.28 (official build))

What should I do to create dictionary with this structure?

Advertisement

Answer

Try to use types with fixed precision, such as Decimal32:

CREATE DICTIONARY test.test_dict_01
(
    `code` String,
    `date` Date,
    `rate` Decimal32(6)
)
PRIMARY KEY code, date
SOURCE(FILE(PATH 'opt/dicts/test.csv'))
LIFETIME(MIN 0 MAX 300)
LAYOUT(COMPLEX_KEY_HASHED())

It looks like a bug, could you create the issue in https://github.com/ClickHouse/ClickHouse/issues?

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement