]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Clickhouse: Fix extra columns that are arrays
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Apr 2020 10:17:09 +0000 (11:17 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Apr 2020 10:17:09 +0000 (11:17 +0100)
src/plugins/lua/clickhouse.lua

index cf70abab4a7f2f98d37fa55a6787257d363e869a..5cce0a442c1b15f46167b1953f8f16b2258230ff 100644 (file)
@@ -1331,8 +1331,14 @@ if opts then
           rspamd_logger.errx(rspamd_config, 'cannot add clickhouse extra row %s: no type or no selector',
               col_name)
         else
+          local is_array = false
+
+          if col_data.type:lower():match('^array') then
+            is_array = true
+          end
+
           local selector = lua_selectors.create_selector_closure(rspamd_config,
-              col_data.selector, col_data.delimiter or '', false)
+              col_data.selector, col_data.delimiter or '', is_array)
 
           if not selector then
             rspamd_logger.errx(rspamd_config, 'cannot add clickhouse extra row %s: bad selector: %s',
@@ -1341,7 +1347,7 @@ 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 is_array then
                 col_data.default_value = {}
               else
                 col_data.default_value = ''