Match查询结果少,与GO查询结果不一致

提问参考模版:

  • nebula 版本:2.0.1
  • 部署方式(分布式 / 单机 / Docker / DBaaS):分布式
  • 是否为线上版本:N
  • 硬件信息
    • 磁盘( 推荐使用 SSD)
    • CPU、内存信息
  • 问题的具体描述
  • 相关的 meta / storage / graph info 日志信息

GO与MATCH查询结果不同,MATCH结果少

现象:

  1. 相同起点id 13eeede2975bf038ba902cced6d2f6a0,扩展1跳,match查询结果只有2个,go可以查到117个

  2. 同样使用match,变换起点查询结果也不同;84dffb0ea23406dddb83ccef497ee553可以查到,13eeede2975bf038ba902cced6d2f6a0差不到

match 要依赖于索引的? 您的索引建了吧?

参考 有关go from 语法和match查询结果不一致的 提问 - #9 由 yangmeng

@RandomJoe 文档里面有说match和go的区别么

我到现在都没搞懂, 到底有啥事不一样 :joy:

go和match的语义并不是等价的,

  1. match会去除循环遍历,go不会对环做特殊处理。
  2. match扩展的是路径,go只是终点的扩展,所以match在扩展的同时会join当前的起点和之前的终点,这样一整条独立的路径产生一个结果,而go则是一个独立的扩展产生一个结果
  1. 你这个两个语句扩展的边类型都不一样
  2. 你用反向查询看一下,我怀疑这个反向边没有插入成功

样例只是扩展一跳,应该不涉及循环遍历问题。
1.边的类型是一样的只有connect有数据
2.边肯定都写成功了,两个方向go都能查到

  1. 看一下反向查询的结果

没明白,怎么返向查询?

go from … over … reversely …

13… 到 84… 反向查询,
你不要截图,直接发文本

没有写入13… <-84… ,只有一条边 13eeede2975bf038ba902cced6d2f6a0->84dffb0ea23406dddb83ccef497ee553

(root@nebula) [ti_graph]> fetch prop on connect "13eeede2975bf038ba902cced6d2f6a0"->"84dffb0ea23406dddb83ccef497ee553"
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| edges_                                                                                                                                               |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| [:connect "13eeede2975bf038ba902cced6d2f6a0"->"84dffb0ea23406dddb83ccef497ee553" @0 {action: "dns", label: "connect", port: __NULL__, ts: __NULL__}] |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
Got 1 rows (time spent 2469/2813 us)

Fri, 04 Jun 2021 11:20:27 CST

(root@nebula) [ti_graph]> fetch prop on connect "84dffb0ea23406dddb83ccef497ee553"->"13eeede2975bf038ba902cced6d2f6a0"
Empty set (time spent 1885/2207 us)

结果是match 由13eeede2975bf038ba902cced6d2f6a0发起查询,无结果

(root@nebula) [ti_graph]> go from "13eeede2975bf038ba902cced6d2f6a0" over connect where connect._dst=="84dffb0ea23406dddb83ccef497ee553" yield connect._dst
+------------------------------------+
| connect._dst                       |
+------------------------------------+
| "84dffb0ea23406dddb83ccef497ee553" |
+------------------------------------+
Got 1 rows (time spent 74158/74471 us)

Fri, 04 Jun 2021 11:08:46 CST

(root@nebula) [ti_graph]> go from "84dffb0ea23406dddb83ccef497ee553" over connect REVERSELY  where connect._dst=="13eeede2975bf038ba902cced6d2f6a0" yield connect._dst
+------------------------------------+
| connect._dst                       |
+------------------------------------+
| "13eeede2975bf038ba902cced6d2f6a0" |
+------------------------------------+
Got 1 rows (time spent 94265/94609 us)

Fri, 04 Jun 2021 11:08:52 CST



(root@nebula) [ti_graph]> MATCH p=(v)<-[e:connect]-(v2) WHERE id(v) IN ["84dffb0ea23406dddb83ccef497ee553"] and id(v2)=="13eeede2975bf038ba902cced6d2f6a0" RETURN p LIMIT 20
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| p                                                                                                                                                                                                                                                                                                                |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| <("84dffb0ea23406dddb83ccef497ee553")<-[:connect@0 {action: "dns", label: "connect", port: __NULL__, ts: __NULL__}]-("13eeede2975bf038ba902cced6d2f6a0" :hash{file_size: 491521, file_type: "PE32 Executable for MS Windows", first_seen: 1604187855, label: "hash", name: "9c2959ec78e372e5a5ea2aae8ae0ae70"})> |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+


(root@nebula) [ti_graph]> MATCH p=(v)-[e:connect]->(v2) WHERE id(v) IN ["13eeede2975bf038ba902cced6d2f6a0"] and id(v2)=="84dffb0ea23406dddb83ccef497ee553" RETURN p LIMIT 20
Empty set (time spent 28328/28658 us)



(root@nebula) [ti_graph]> go from "13eeede2975bf038ba902cced6d2f6a0" over connect REVERSELY where connect._dst=="84dffb0ea23406dddb83ccef497ee553" yield connect._dst
Empty set (time spent 1403/1712 us)

问题找到了,因为終点(84…)没有任何属性,导致结果被过滤掉。
插入属性后,可以查到结果。

(root@nebula) [ti_graph]> fetch prop on * "84dffb0ea23406dddb83ccef497ee553" 
Empty set (time spent 2132/2414 us)

Fri, 04 Jun 2021 14:29:33 CST

(root@nebula) [ti_graph]> MATCH p=(v)-[e:connect]->(v2) WHERE id(v)=="13eeede2975bf038ba902cced6d2f6a0" and id(v2)=="84dffb0ea23406dddb83ccef497ee553" RETURN p LIMIT 20
Empty set (time spent 26404/26649 us)

Fri, 04 Jun 2021 14:29:44 CST

(root@nebula) [ti_graph]> insert vertex domain(name,label) values "84dffb0ea23406dddb83ccef497ee553":("www.hCXihq2JDU.com domain","domain")
Execution succeeded (time spent 1475/1741 us)

Fri, 04 Jun 2021 14:30:34 CST

(root@nebula) [ti_graph]> MATCH p=(v)-[e:connect]->(v2) WHERE id(v)=="13eeede2975bf038ba902cced6d2f6a0" and id(v2)=="84dffb0ea23406dddb83ccef497ee553" RETURN p LIMIT 20
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| p                                                                                                                                                                                                                                                                                                                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| <("13eeede2975bf038ba902cced6d2f6a0" :hash{file_size: 491521, file_type: "PE32 Executable for MS Windows", first_seen: 1604187855, label: "hash", name: "9c2959ec78e372e5a5ea2aae8ae0ae70"})-[:connect@0 {action: "dns", label: "connect", port: __NULL__, ts: __NULL__}]->("84dffb0ea23406dddb83ccef497ee553" :domain{dynamic: __NULL__, label: "domain", name: "www.hCXihq2JDU.com domain", sld: __NULL__})> |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

这种场景是不是有语义歧义?虽然84…没有属性,但是是实际存在的,正常应该能够查到。

这个点怎么插入的

看你的情况可能并没有插入这个点,只是有13指向84的边

没有属性的点没有插入,创建边时不会自动创建相关顶点吗?

不会,点都是插入才有

为啥studio可以查到


不存在的点会有提示


浙ICP备20010487号