如何从dictget函数中的dictionary_name中从列中取一个concat字符串

发布于 2025-01-19 17:01:18 字数 653 浏览 4 评论 0原文

我在 ClickHouse DB 中构建了一个动态字典。它将在 SQL 命令执行之前创建字典。此外,词典名称也是同时创建的。

字典名称是日期和表名称的组合字符串。因为我不想在长期词典中保留这么多数据,所以短期词典可能会在大约一小时后无人使用时释放内存提供很大帮助。

错误发生了。

当我在 SQL 命令中使用字典时,使用实体命令就可以了。 例如 dictGet(CONCAT('2022-04-06', 'MyTableName'), 'GetBackColumnName',myKeyColumn) AS col_name

但是当我更改为使用表中的列时,它被破坏了。 例如 dictGet(CONCAT(DATE_COL, 'MyTableName'), 'GetBackColumnName',myKeyColumn) AS col_name

并且显示错误消息。

函数 dictGet 第一个参数的 String 类型非法, 需要一个常量字符串。

有谁知道如何解决这个问题?

我的 CH 版本是:20.8.7.15

我尝试从 ClickHouse 办公室报告中找到解决方案,但没有任何方法可以解决此问题。我尝试了 String 的很多函数来弄清楚发生了什么。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文