{{ctrl.target.rawQuery}}
Macros
$table - replaced with selected table name from Query Builder
$dateCol - replaced with Date:Col value from Query Builder
$dateTimeCol - replaced with Column:DateTime or Column:TimeStamp value from Query Builder
$from - replaced with (timestamp with ms)/1000 value of UI selected "Time Range:From"
$to - replaced with (timestamp with ms)/1000 value of UI selected "Time Range:To"
$interval - replaced with selected "Group by time interval" value (as a number of seconds)
$timeFilter - replaced with currently selected "Time Range".
Require Column:Date and Column:DateTime or Column:TimeStamp to be selected
$timeSeries - replaced with special ClickHouse construction to convert results as time-series data.
Use it as "SELECT $timeSeries...". Require Column:DateTime or Column:TimeStamp to be selected
$naturalTimeSeries - replaced with special ClickHouse construction to convert results as time-series data in logical/natural units.
Use it as "SELECT $naturalTimeSeries...". Require Column:DateTime or Column:TimeStamp to be selected
$unescape - unescapes variable value by removing single quotes.
Used for multiple-value string variables: "SELECT $unescape($column) FROM requests WHERE $unescape($column) = 5"
$adhoc - replaced with a rendered ad-hoc filter expression, or "1" if no ad-hoc filters exist
A description of macros is available by typing their names in Raw Editor
Functions (Only one function per query allowed)
$rate(cols...) - function to convert query results as "change rate per interval".
Example usage: $rate(countIf(Type = 200) * 60 AS good, countIf(Type != 200) * 60 AS bad) FROM requests
$columns(key, value) - function to query values as array of [key, value], where key would be used as label.
Example usage: $columns(Type, count() c) FROM requests
$rateColumns(key, value) - is an combination of $columns and $rate.
Example usage: $rateColumns(Type, count() c) FROM requests