|
我用相同的一个表自己 inner join 自己,取不同时间点,得到相同值
sql是这样,p5m 和 p0m 都是 snmpprobe.p_snmp_ifxtable 表,时间不同
select
p0m.coltime, p0m.ifhcinoctets a, p0m.ifhcoutoctets c,
p5m.coltime, p5m.ifhcinoctets b, p5m.ifhcoutoctets d
from snmpprobe.p_snmp_ifxtable as p0m
inner join snmpprobe.p_snmp_ifxtable as p5m on p0m.id=p5m.id and p0m.mibindex=p5m.mibindex
where p5m.dt='2020-11-23' and p5m.hh='01' and p5m.mi='00' and p5m.mibindex=4 and p5m.ip='172.31.28.4'
and p0m.dt='2020-11-23' and p0m.hh='00' and p0m.mi='55';
用flink sql client执行,计算结果是
coltime,a,c,coltime0, b,d
2020-11-23T01:00 ,3702300836,5541513669,2020-11-23T01:00,3702300836,5541513669
这里 coltime= coltime0,都是2020-11-23T01:00, 同时 a=b,c=d
hive 行命令查询结果是
2020-11-23 00:55:00.000000000,3702187169,5541332531,2020-11-23 01:00:00.000000000,3702300836,5541513669
coltime=2020-11-23 00:55:00.000000000 , coltime0=2020-11-23 01:00:00.000000000,a!=c, b!=d
flink 结果明显不正确,flink sql 的self join 需要什么特殊写法吗?
|