在使用dashboard的模板变量时,选择all时,如下clickhouse查询语句查询,无法解析正确执行:
sql
SELECT orderId,OrderJsonStr FROM xdatabase."xxxx_table" WHERE ( createTime >= $__fromTime AND createTime <= $__toTime ) AND orderId IN (${orderId}) ORDER BY orderId DESC LIMIT 300
优化为:
sql
SELECT orderId,OrderJsonStr FROM xdatabase."xxxx_table" WHERE ( createTime >= $__fromTime AND createTime <= $__toTime ) AND $__conditionalAll(orderId IN (${orderId:singlequote}), $orderId) ORDER BY orderId DESC LIMIT 300
可正常执行,选择all时语句变为 1=1
参考