flink版本 1.11.1
有两个over窗口对应的view,计算逻辑都是当前的事件时间 hitDateTime 向前推一定时间作为窗口,计算相同的ruleName
记录数量,一个向前推15分钟,一个30分钟。
hitAt字段是一个long类型的时间戳,hitDateTime 是根据hitAt转换为DateTime类型的时间。
create view v1 as
select
ruleName ,
hitAt ,
hitDateTime,
count(*) over w1 as count15minByRuleName,
0 as count30minByRuleName
from common_rule_param_result_topic_middle
window w1 as (partition by ruleName order by hitDateTime asc RANGE BETWEEN
INTERVAL '15' minute preceding AND CURRENT ROW);
create view v2 as
select
ruleName ,
hitAt ,
hitDateTime,
0 count15minByRuleName,
count(*) over w1 as count30minByRuleName
from common_rule_param_result_topic_middle
window w1 as (partition by ruleName order by hitDateTime asc RANGE BETWEEN
INTERVAL '30' minute preceding AND CURRENT ROW);
现在想把两个view
join起来,以便能够在一个结果中就直接输出count15minByRuleName,count30minByRuleName结果。
select
v1.ruleName,
v1.hitAt,
v1.count15minByRuleName,
v2.count30minByRuleName
from v1 join v2
on v1.ruleName=v2.ruleName and v1.hitAt=v2.hitAt;
输出的结果是 count15minByRuleName和count30minByRuleName
两个值一直是一样的。即使count30minByRuleName 应该比count15minByRuleName大的情况下。
请教下是啥原因,不能这么join么。
--
Sent from:
http://apache-flink.147419.n8.nabble.com/