commit e18234e: [Feature] Clickhouse: Add extra columns support

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 17 14:42:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-17 14:18:50 +0000
URL: https://github.com/rspamd/rspamd/commit/e18234e27fab11400354c6d57d9841b593acbfcb

[Feature] Clickhouse: Add extra columns support

---
 src/plugins/lua/clickhouse.lua | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index ab1693b48..a5067d014 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -843,7 +843,7 @@ local function clickhouse_collect(task)
   -- Extra columns
   if #settings.extra_columns > 0 then
     for _,col in ipairs(settings.extra_columns) do
-      local elts = col.selector(task)
+      local elts = col.real_selector(task)
 
       if elts then
         table.insert(row, elts)
@@ -1337,12 +1337,13 @@ if opts then
             settings.extra_columns[col_name] = nil
           else
             if not col_data.default_value then
-              if col_data.type:lower():match('Array') then
+              if col_data.type:lower():match('^array') then
                 col_data.default_value = {}
               else
                 col_data.default_value = ''
               end
             end
+            col_data.real_selector = selector
           end
         end
       end


More information about the Commits mailing list