Nebula 1.0版本Go From语句查询存在bug

nebula 版本:1.0
背景: 我们这边需要做1.0升级到3.6版本,发现相同的数据1.0和3.6相同的nGQL不一致,经过排查是1.0的执行语句返回结果有问题,也就是线上依赖的数据是错误的,但是貌似升级成3.6数据是对了,但是可能依赖错误数据的程序就有问题
发帖目的: 搞清楚1.0是如何执行的,然后通过3.6曲线实现1.0的结果
bug说明: 在特定的场景下,

go from a,b over u yield u._dst as id | go from $-.dst_id over xxx

go from a over u yield u._dst as id | go from $-.dst_id over xxx 
union all 
go from b over u yield u._dst as id | go from $-.dst_id over xxx

不一致

bug复现

insert vertex user(uname,old) values 11:("T_A",0);
insert vertex user(uname,old) values 12:("T_B",0);
insert vertex user(uname,old) values 13:("T_C",0);
insert vertex user(uname,old) values 14:("T_D",0); 
insert vertex user(uname,old) values 15:("T_E",0);
insert vertex user(uname,old) values 16:("T_F",0);

insert vertex ball(bname) values 21:("basktball"),22:("football");

insert edge like(pname) values 11->21:("a"),12->21:("b"),13->21:("c"),14->21:("d"),15->22("e");
insert edge like(pname) values 16->22:("h"),13->22:("g"),14->22:("f");

找出与11有共同爱好的人的列表:

GO FROM 11 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id

找出与12有共同爱好的人的列表:
GO FROM 12 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id

找出与11、12有共同爱好的人的列表:

GO FROM 11,12 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id | order by $-.dst_id ASC,$-.start_id ASC;

** :worried:结果错了,只包含了12的共同爱好的人列表,从结果上看感觉12检索了两次 **

将11和12调换顺序:

GO FROM 12,11 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id | order by $-.dst_id ASC,$-.start_id ASC;

:worried:结果显示,只包含了11的共同爱好的人列表


居然调换from的顺序都会影响结果

使用union all的方式重新查一次:

(GO FROM 11 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id union all GO FROM 12 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id) | order by $-.dst_id ASC,$-.start_id ASC;
:grin:结果正确,既包含了11,又包含了12

猜想: 这里因为11和12有共同的喜好,可能会导致问题,那么取不同的喜好的人一起查看是否会有问题?
11喜欢basktball,15喜欢football,这里就取11和15作为共同搜索

先查询15共同爱好的人列表:

GO FROM 15 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id

11和15有共同爱好的人列表:

GO FROM 15,11 OVER like YIELD like._dst AS dst_id, like._src as src_id | GO FROM $-.dst_id over like REVERSELY where $-.src_id != like._dst YIELD $-.src_id as start_id,like._dst as dst_id | order by $-.dst_id ASC,$-.start_id ASC;

** :grin:结果正确**

结论: nebula 1.0在合并查询时如果from的点有共同喜好就会出现覆盖问题,并且后面的点覆盖之前的点的数据

1 个赞

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。