摘要:前言支持三种数据查询类型。,,是无维度,支持单维度,支持双维度。现在有一个需求基于服务名和调用链的两个维度,从获取最大分位数的前五名数据。但是没有排序查看官方文档的查询格式。官网上明确标识可以通过实现查询。其中可以限制返回数量。
前言
druid支持三种数据查询类型。timeseries,topn,groupby
timeseries是无维度,topn支持单维度,groupby支持双维度。现在有一个需求:基于服务名和调用链的两个维度,从druid获取最大分位数的前五名数据。topn是单维度的。groupby是双维度的。但是没有排序
groupby的查询格式。官网上明确标识可以通过groupby实现topn查询。
{
"queryType": "groupBy",
"dataSource": "sample_datasource",
"granularity": "day",
"dimensions": ["country", "device"],
"limitSpec": { "type": "default", "limit": 5000, "columns": ["country", "data_transfer"] },
"filter": {
"type": "and",
"fields": [
{ "type": "selector", "dimension": "carrier", "value": "AT&T" },
{ "type": "or",
"fields": [
{ "type": "selector", "dimension": "make", "value": "Apple" },
{ "type": "selector", "dimension": "make", "value": "Samsung" }
]
}
]
},
"aggregations": [
{ "type": "longSum", "name": "total_usage", "fieldName": "user_count" },
{ "type": "doubleSum", "name": "data_transfer", "fieldName": "data_transfer" }
],
"postAggregations": [
{ "type": "arithmetic",
"name": "avg_usage",
"fn": "/",
"fields": [
{ "type": "fieldAccess", "fieldName": "data_transfer" },
{ "type": "fieldAccess", "fieldName": "total_usage" }
]
}
],
"intervals": [ "2012-01-01T00:00:00.000/2012-01-03T00:00:00.000" ],
"having": {
"type": "greaterThan",
"aggregation": "total_usage",
"value": 100
}
}
其中limitspec可以限制返回数量。但是没有说可以排序。真的无语
点击查看limitspec的详情http://druid.io/docs/0.12.1/q...
官方文档还是写的很详细的,多看官方文档有益身心。
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/76643.html
摘要:俗名德鲁伊是一个为在大数据集之上做实时统计分析而设计的开源数据存储。下文都以德鲁伊代表为什么创建德鲁伊在最近几年,互联网技术的快速增长已经产生了大量由机器产生的数据。通过请求访问数据库 什么是druid 与某连接池同名,但完全是两个东西。Druid(俗名德鲁伊)是一个为在大数据集之上做实时统计分析而设计的开源数据存储。这个系统集合了一个面向列存储的层,一个分布式、shared-noth...
阅读 1212·2021-11-16 11:45
阅读 2359·2021-10-09 09:44
阅读 1557·2019-08-30 14:03
阅读 1363·2019-08-26 18:28
阅读 3558·2019-08-26 13:50
阅读 1981·2019-08-23 18:38
阅读 3650·2019-08-23 18:22
阅读 3863·2019-08-23 15:27