Druid 的几个查询实例

2021-08-03 10:35:10 浏览数 (2)

下面是你可以在 Druid 上尝试进行查询的一些实例供你测试:

对时间进行查询

代码语言:javascript复制
SELECT FLOOR(__time to HOUR) AS HourTime, SUM(deleted) AS LinesDeleted
FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00'
GROUP BY 1

基本的 group by

代码语言:javascript复制
SELECT channel, page, SUM(added)
FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00'
GROUP BY channel, page
ORDER BY SUM(added) DESC

Druid 能够进行一些比较灵活的查询,因此对基本的 SQL 掌握还是需要的。

https://www.ossez.com/t/druid/13633

0 人点赞