假设我们有一个 SQL 的查询是:
WHERE NOT ("TimeseriesId" = '3875A165-E34D-427C-BDDB-42AB41F69D4B' and "__time" = TIMESTAMP '2021-10-06 18:01:00.000')
如果转换为 Druid 的查询就是过滤器了。
过滤器的写法如下:
"filter": {
"type": "or",
"fields": [
{
"type": "not",
"field": {
"type": "selector",
"dimension": "TimeseriesId",
"value": "3875A165-E34D-427C-BDDB-42AB41F69D4B",
"extractionFn": null
}
},
{
"type": "not",
"field": {
"type": "selector",
"dimension": "__time",
"value": "1633543260000",
"extractionFn": null
}
}
]
},
在这里需要注意下的就是这个时间戳的问题,你需要转换为 Unix 时间才可以。