升级版本后match和go无法使用管道符拼接

最近在升级,从Nebula2.5.1升级到3.4.1,有一个语句发现不能用了,请问如何改写?

match (v:ai_ti) where v.ai_ti.name == '1677642430002' and v.ai_ti.device_model == 'Model' and [n IN split(v.ai_ti.system_version,'.') | TOINTEGER(n)] <= [9, 5, 7] return id(v) as VertexID \
 | go from $-.VertexID over to_mid where $$.mid.name IS NOT EMPTY  yield DISTINCT to_mid._dst as vid, $$.mid.name as name, $$.mid.epv as epv, $$.mid.wpv as wpv, 'ai_ti' as from_label

因为需要逐位比较system_version大小,所以用了match,没有发现好办法改写,在2.5.1这种写法是没问题的

match (v:ai_ti) where v.name == '1677642430002' and v.device_model == 'Model' and [n IN split(v.system_version,'.') | TOINTEGER(n)] <= [9, 5, 7] return id(v) as VertexID \
 | go from $-.VertexID over to_mid where $$.mid.name IS NOT EMPTY  yield DISTINCT to_mid._dst as vid, $$.mid.name as name, $$.mid.epv as epv, $$.mid.wpv as wpv, 'ai_ti' as from_label

正如在群里说的那样,管道 | 是不能和 MATCH 混用的,GO(原生语法)也是不能和 MATCH(Cypher 语法)混用的。:thinking: 你可以用 WITH 替换掉管道,GO 的查询用 MATCH 来表达下。

match (v:ai_ti) 
where v.name == '1677642430002' 
      and v.device_model == 'Model' 
      and [n IN split(v.system_version,'.') | TOINTEGER(n)] <= [9, 5, 7] 
match (v)-[e:to_mid]-(v2)
where v2.mid.name is not empty
return distinct id(v2) as vid, 
       v2.mid.name as name, 
       v2.mid.epv as epv, 
       v2.mid.wpv as wpv, 
       'ai_ti' as from_label
2 个赞

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