return query:gsub('%s', '%%20')
end
+local function ch_number(a)
+ if (a+2^52)-2^52 == a then
+ -- Integer
+ return tostring(math.floor(a))
+ end
+
+ return tostring(a)
+end
+
local function clickhouse_quote(str)
if str then
return str:gsub('[\'\\]', '\\%1'):lower()
for i,elt in ipairs(ar) do
if type(elt) == 'string' then
ar[i] = '\'' .. clickhouse_quote(elt) .. '\''
- else
- ar[i] = tostring(elt)
+ elseif type(elt) == 'number' then
+ ar[i] = ch_number(elt)
end
end
for i,elt in ipairs(row) do
if type(elt) == 'table' then
row[i] = '[' .. array_to_string(elt) .. ']'
- else
- row[i] = tostring(elt) -- Assume there are no tabs there
+ elseif type(elt) == 'number' then
+ row[i] = ch_number(elt)
end
end
})
local action = task:get_metric_action('default')
+ local digest = task:get_digest()
table.insert(main_rows, {
today(timestamp),
if #attachments_fnames > 0 then
table.insert(attachment_rows, {
today(timestamp),
- task:get_digest(),
+ digest,
attachments_fnames,
attachments_ctypes,
attachments_lengths,
if #urls_tlds > 0 then
table.insert(urls_rows, {
today(timestamp),
- task:get_digest(),
+ digest,
urls_tlds,
urls_urls
})
if #emails > 0 then
table.insert(emails_rows, {
today(timestamp),
- task:get_digest(),
+ digest,
emails,
})
end
end
table.insert(asn_rows, {
today(timestamp),
- task:get_digest(),
+ digest,
asn,
country,
ipnet
if s.options then
table.insert(options_tab, table.concat(s.options, ','))
else
- table.insert(options_tab, "''");
+ table.insert(options_tab, '');
end
end
table.insert(symbols_rows, {
today(timestamp),
+ digest,
syms_tab,
scores_tab,
options_tab