1 year ago

#381472

test-img

Kai

How to take a concat String from column as a Dictionary_Name in dictGet function

I build a dynamic Dictionary in ClickHouse DB. It will create the dictionary before the SQL commands execute. Also, the dictionary name was created at the same time.

The dictionary name was a combined string by date and table name. Because I don't want to keep so much data in the long-term dictionary, the short-term Dictionary could be a great help to release the memory after maybe an hour when no one is using it.

And the error happened.

When I use the dictionary in my SQL commands it is okay with solid commands. e.g. dictGet(CONCAT('2022-04-06', 'MyTableName'), 'GetBackColumnName',myKeyColumn) AS col_name

But when I change to using the column from Table, it was broken. e.g. dictGet(CONCAT(DATE_COL, 'MyTableName'), 'GetBackColumnName',myKeyColumn) AS col_name

And the error message shows up.

Illegal type String of the first argument of function dictGet, expected a const string.

Does anyone know how to fix the issue?

My CH version is: 20.8.7.15

I try to find the resolution from the ClickHouse office report but nothing can fix this issue. And I tried lots of functions of String to figure out what happened.

clickhouse

0 Answers

Your Answer

Accepted video resources