- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以让 Druid 数据源包含 2 个(或多个)时间戳?我知道 Druid 是基于时间的数据库,我对这个概念没有问题,但我想添加另一个维度,我可以使用它来处理时间戳
例如用户保留:指标肯定是指定到某个特定日期的,但我还需要根据用户注册日期创建群组,并将这些日期汇总到一周、几个月或仅过滤到特定时间段......
如果不支持该功能,是否有任何插件?有什么肮脏的解决方案吗?
最佳答案
虽然我宁愿等待 Druid 中时间戳维度完全支持的正式实现,但我发现了我一直在寻找的“肮脏”黑客。
数据源架构
首先,我想知道每天有多少用户登录,并且能够按日期/月/年群组进行聚合
这是我使用的数据架构:
"dataSchema": {
"dataSource": "ds1",
"parser": {
"parseSpec": {
"format": "json",
"timestampSpec": {
"column": "timestamp",
"format": "iso"
},
"dimensionsSpec": {
"dimensions": [
"user_id",
"platform",
"register_time"
],
"dimensionExclusions": [],
"spatialDimensions": []
}
}
},
"metricsSpec": [
{ "type" : "hyperUnique", "name" : "users", "fieldName" : "user_id" }
],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "HOUR",
"queryGranularity": "DAY",
"intervals": ["2015-01-01/2017-01-01"]
}
},
因此示例数据应类似于(每条记录都是登录事件):
{"user_id": 4151948, "platform": "portal", "register_time": "2016-05-29T00:45:36.000Z", "timestamp": "2016-06-29T22:18:11.000Z"}
{"user_id": 2871923, "platform": "portal", "register_time": "2014-05-24T10:28:57.000Z", "timestamp": "2016-06-29T22:18:25.000Z"}
如您所见,我计算这些指标的“主要”时间戳是 timestamp 字段,其中 register_time 只是 stringy 中的维度 - ISO 8601 UTC format .
聚合
现在,有趣的部分是:由于Time Format Extraction Function,我已经能够通过时间戳(日期)和注册时间(再次日期)进行聚合。
查询看起来像这样:
{
"intervals": "2016-01-20/2016-07-01",
"dimensions": [
{
"type": "extraction",
"dimension": "register_time",
"outputName": "reg_date",
"extractionFn": {
"type": "timeFormat",
"format": "YYYY-MM-dd",
"timeZone": "Europe/Bratislava" ,
"locale": "sk-SK"
}
}
],
"granularity": {"timeZone": "Europe/Bratislava", "period": "P1D", "type": "period"},
"aggregations": [{"fieldName": "users", "name": "users", "type": "hyperUnique"}],
"dataSource": "ds1",
"queryType": "groupBy"
}
过滤
过滤的解决方案基于JavaScript Extraction Function我可以用它将日期转换为 UNIX 时间并在内部使用它(例如) bound filter :
{
"intervals": "2016-01-20/2016-07-01",
"dimensions": [
"platform",
{
"type": "extraction",
"dimension": "register_time",
"outputName": "reg_date",
"extractionFn": {
"type": "javascript",
"function": "function(x) {return Date.parse(x)/1000}"
}
}
],
"granularity": {"timeZone": "Europe/Bratislava", "period": "P1D", "type": "period"},
"aggregations": [{"fieldName": "users", "name": "users", "type": "hyperUnique"}],
"dataSource": "ds1",
"queryType": "groupBy"
"filter": {
"type": "bound",
"dimension": "register_time",
"outputName": "reg_date",
"alphaNumeric": "true"
"extractionFn": {
"type": "javascript",
"function": "function(x) {return Date.parse(x)/1000}"
}
}
}
我尝试使用 javascript 过滤器“直接”过滤它,但我无法说服 druid 返回正确的记录,尽管我已经使用各种 JavaScript REPL 仔细检查了它,但是嘿,我不是 JavaScript专家。
关于druid - Druid 中是否有可能有另一个时间戳作为维度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38008495/
是否可以让 Druid 数据源包含 2 个(或多个)时间戳?我知道 Druid 是基于时间的数据库,我对这个概念没有问题,但我想添加另一个维度,我可以使用它来处理时间戳 例如用户保留:指标肯定是指定到
我们正在对 Druid 进行 POC,以检查它是否适合我们的用例。虽然我们能够摄取数据但不确定以下内容: druid 如何支持无模式输入:假设输入维度由最终用户自行决定。然后这里没有定义的模式。因此,
Druid 如何在将实时摄取的数据移交给深度存储之前保留它? 文档中Druid有intermedatepersistperiod和maxpendingpersists的配置。但它并没有太多说明什么是中
当我将 JSON 摄取规范发送到 Druid 霸主 API 时,我得到以下响应: HTTP/1.1 400 Bad Request Content-Type: application/json Dat
我正在尝试将以下德鲁伊 sql 查询转换为德鲁伊 json 查询,因为我拥有的列之一是多值维度,德鲁伊不支持 sql 样式查询。 我的sql查询: SELECT date_dt, source, ty
例如我有以下 Druid 查询: "filter": { "type": "and", "fields": [ { "type": "selector",
我正在尝试在超过 500k 数据限制的情况下运行 groupBy 查询。我收到此错误。 { "error": "Resource limit exceeded", "errorMess
我使用 Druid 来监控我网站中的事件。 数据可以表示如下: event_id | country | user_id | event_type ==================
我在历史节点上存储了大约 10GB 的数据。但是,该节点的内存消耗约为 2GB。 当我启动一个选择查询时,结果在 30 多秒内第一次返回。接下来,它们排在第二位(因为代理缓存)。 我关心的是将任何查询
我创建了一个架构,并向德鲁伊架构添加了 1TB 数据。然后升级了日志文件版本并添加了新的两列。然后我想将该数据添加到德鲁伊模式。但还不能。 最佳答案 为了向现有数据源添加新列,您需要按照以下步骤操作:
我有分析服务器(例如点击计数器)。我想使用一些 api 向德鲁伊发送数据。我该怎么做?我可以用它代替谷歌分析吗? 最佳答案 正如 se7entyse7en 所说: You can ingest you
我是德鲁伊新手。我想从我的 java 应用程序查询远程 druid 集群。我在 druid-user google group 中读到我们可以使用 io.druid.client.DirectDrui
Apache Druid简介 Apache Druid是一个实时分析型数据库,旨在对大型数据集进行快速的查询分析("OLAP"查询)。Druid最常被当做数据库来用以支持实时摄取、高性能查询和高稳定运
我似乎在 Druid 网站上找不到任何特定的教程/文档页面,其中列出了 Druid 中所有支持的维度数据类型。从我读了多少,我知道 long, float和 string绝对支持,但我对其他支持的类型
前言 在 上一篇文章 中,我们介绍了弹性数据库连接失效的背景,并探讨了HikariCP连接池探活策略的相关内容。在本文中,我们将会继续探讨另一个线上常用的连接池——Druid,并为您介绍如何在使
Druid是阿里巴巴开发的一个连接池,他提供了一个高效、功能强大、可扩展性好的数据库连接池,区别于hikari。如果选择高性能可以选hikari,如果要功能多就选,druid。 首先pom引入依赖
我们如何在德鲁伊中写 sum(distinct col) ?如果我尝试用德鲁伊编写,它说无法构建计划,但在德鲁伊中也是可能的。我尝试转换为子查询方法,但我的内部查询返回大量项目级数据,因此超时。 最佳
我正在使用 imply 来处理德鲁伊的集群。但是我的日志文件已增加到数百 GB 的存储空间。我说的是存在于 imply/var/sv/目录中的日志文件,其中有这 7 个日志文件,broker.log、
通过遵循 http://druid.io/docs/latest/tutorials/tutorial-loading-streaming-data.html 的教程,我能够通过 Kafka 控制台将
Druid 集群在数据摄取后,数据源的某些数据段显示不可用。例如:72.4% 可用(2352 个分段,647 个分段不可用)我们有一个集群部署 3 个节点:主节点(协调器和霸主)数据节点(历史和中间管
我是一名优秀的程序员,十分优秀!