Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help with single site windowed query with join #25656

Open
liujiangithub opened this issue May 7, 2024 · 0 comments
Open

help with single site windowed query with join #25656

liujiangithub opened this issue May 7, 2024 · 0 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@liujiangithub
Copy link

liujiangithub commented May 7, 2024

数据现状:
1 超级表字段 (ts timestamp, v double), tag(设备,变量名)
2 存储单点数据,每个设备的每个变量单独一张子表。每个设备的变量上报周期不完全相同(ts不一致)。
需求:
需要查询某个时间段,某个周期,某些设备某些变量的值,如每分钟,2个设备4个变量的值,返回结果格式如下
时间 设备 变量1 变量2 变量3 变量4
2024-05-07 11:37:00.0000000 device1 1.1 xx yy zz
2024-05-07 11:37:00.0000000 device2 2.1 ...
2024-05-07 11:38:00.0000000 device1 1.2 ...
2024-05-07 11:38:00.0000000 device2 2.2 ...

现有尝试:
子查询使用子表窗口查询得到子表每分钟的值,再嵌套时间相等的联表查询,如
select * from (select tbname as tn,_wstart as t,first(value) as v from table2 where ts >='2024-05-06 07:00:00.000' and ts <= '2024-05-06 11:05:00' partition by tbname interval(10m) fill(prev)) t1,(select tbname as tn,_wstart as t,first(value) as v from table3 where ts >='2024-05-06 07:00:00.000' and ts <= '2024-05-06 11:05:00' partition by tbname interval(10m) fill(prev)) t2 where t1.t = t2.t;
收到失败:DB error: Join requires valid time series input
看起来是连接条件时间不对。

操作截图:
企业微信截图_17151320905648

问题:
1 联表查询必须是真实的表的时间字段么,子查询中的时间字段作为join条件不行?
2 如果使用stream将原始表每分钟的数据导入到另外一张超级表,然后从新表中使用时间戳联表查询这种方式是否可行?
3 目前不想创建stream, 产生多余一份数据存储的情况下,对这类需求有什么更好的方式?
4 这类单点数据最终聚合成一张表的需求应该不是个例,官方对这类问题的处理建议是什么?

@liujiangithub liujiangithub added help wanted Extra attention is needed question Further information is requested labels May 7, 2024
@danielclow danielclow changed the title 单点数据窗口查询后再联表查询的处理方式 help with single site windowed query with join May 8, 2024
@yu285 yu285 self-assigned this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants