Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/interpreter/clickhouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,13 +836,7 @@ impl ClickHouse {
{} AS start_time_,
{} AS end_time_
SELECT
if(empty(symbols),
arrayStringConcat(arrayMap(
addr -> demangle(addressToSymbol(addr)),
arrayReverse(trace)
), ';'),
arrayStringConcat(symbols, ';')
) AS human_trace,
{} AS human_trace,
{} weight
FROM {}
WHERE
Expand All @@ -869,6 +863,24 @@ impl ClickHouse {
),
None => "toDateTime64(now(), 6)".to_string(),
},
if self.quirks.has(ClickHouseAvailableQuirks::TraceLogHasSymbols) {
r#"
if(empty(symbols),
arrayStringConcat(arrayMap(
addr -> demangle(addressToSymbol(addr)),
arrayReverse(trace)
), ';'),
arrayStringConcat(arrayReverse(symbols), ';')
)
"#
} else {
r#"
arrayStringConcat(arrayMap(
addr -> demangle(addressToSymbol(addr)),
arrayReverse(trace)
), ';')
"#
},
match trace_type {
TraceType::Memory => "abs(sum(size))",
_ => "count()",
Expand Down
5 changes: 4 additions & 1 deletion src/interpreter/clickhouse_quirks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ pub enum ClickHouseAvailableQuirks {
ProcessesElapsed,
ProcessesCurrentDatabase,
AsynchronousMetricsTotalIndexGranularityBytesInMemoryAllocated,
TraceLogHasSymbols,
}

const QUIRKS: [(&str, ClickHouseAvailableQuirks); 3] = [
// List of quirks (that requires workaround) or new features.
const QUIRKS: [(&str, ClickHouseAvailableQuirks); 4] = [
// https://github.com/ClickHouse/ClickHouse/pull/46047
//
// NOTE: I use here 22.13 because I have such version in production, which is more or less the
Expand All @@ -23,6 +25,7 @@ const QUIRKS: [(&str, ClickHouseAvailableQuirks); 3] = [
">=24.11, <25.6",
ClickHouseAvailableQuirks::AsynchronousMetricsTotalIndexGranularityBytesInMemoryAllocated,
),
(">=25.1", ClickHouseAvailableQuirks::TraceLogHasSymbols),
];

pub struct ClickHouseQuirks {
Expand Down
Loading