带有合并的gremlin order by复制了一些值
在某些情况下,当我将带有合并的gremlin order by复制了一些值,gremlin,tinkerpop,Gremlin,Tinkerpop,在某些情况下,当我将order().by(…)与coalesce(…)一起使用时,会得到无法解释的结果。 使用标准现代图形 gremlin> g.V() .hasLabel("person") .out("created") .coalesce(values("name"), constant("x")) .fold() ==>[lop,lop,ripple,lop] 但是如果我在合并之前按名称排序,我
order().by(…)
与coalesce(…)
一起使用时,会得到无法解释的结果。
使用标准现代图形
gremlin> g.V()
.hasLabel("person")
.out("created")
.coalesce(values("name"), constant("x"))
.fold()
==>[lop,lop,ripple,lop]
但是如果我在合并之前按名称排序,我会得到9lop
,而不是3:
gremlin> g.V()
.hasLabel("person")
.out("created")
.order().by("name")
.coalesce(values("name"), constant("x"))
.fold()
==>[lop,lop,lop,lop,lop,lop,lop,lop,lop,ripple]
为什么这两个查询的元素数量不同?这看起来像个bug-我创建了一个。有一个解决办法,但首先要考虑的是,即使在bug被搁置的情况下,您的遍历也不起作用,
g.V().
hasLabel("person").
out("created").
order().by(coalesce(values('name'),constant('x')))
然后,我使用choose()
执行coalesce()
应该执行的操作:
g.V().
hasLabel("person").
out("created").
order().by(coalesce(values('name'),constant('x'))).
choose(has("name"),values('name'),constant('x')).
fold()
这似乎很管用。你是个天才