diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-26 14:32:42 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-26 14:32:42 +0000 |
commit | 340d2e50d3fed6514a26566612534c384a008f4c (patch) | |
tree | bb548f831e5fa7c7b37274ac0c5f79e8791aaa46 | |
parent | a1b9dffcf77bbb129d267a422e68721f9e034f11 (diff) | |
download | rspamd-340d2e50d3fed6514a26566612534c384a008f4c.tar.gz rspamd-340d2e50d3fed6514a26566612534c384a008f4c.zip |
[Minor] Clickhouse: Fix text returns
-rw-r--r-- | lualib/lua_clickhouse.lua | 7 | ||||
-rw-r--r-- | src/plugins/lua/clickhouse.lua | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lualib/lua_clickhouse.lua b/lualib/lua_clickhouse.lua index e532cd643..4e20229b0 100644 --- a/lualib/lua_clickhouse.lua +++ b/lualib/lua_clickhouse.lua @@ -74,10 +74,13 @@ end local function row_to_tsv(row) for i,elt in ipairs(row) do - if type(elt) == 'table' then + local t = type(elt) + if t == 'table' then row[i] = '[' .. array_to_string(elt) .. ']' - elseif type(elt) == 'number' then + elseif t == 'number' then row[i] = ch_number(elt) + elseif t == 'userdata' then + row[i] = clickhouse_quote(tostring(elt)) else row[i] = clickhouse_quote(elt) end diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index c9d0c71cc..3ee4eeb73 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -851,10 +851,10 @@ local function clickhouse_collect(task) table.insert(custom_rows[k], lua_clickhouse.row_to_tsv(rule.get_row(task))) end - nrows = nrows + 1 local tsv_row = lua_clickhouse.row_to_tsv(row) used_memory = used_memory + #tsv_row data_rows[#data_rows + 1] = tsv_row + nrows = nrows + 1 lua_util.debugm(N, task, "add clickhouse row %s / %s; used memory: %s / %s", nrows, settings.limits.max_rows, |