Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有合并的gremlin order by复制了一些值_Gremlin_Tinkerpop - Fatal编程技术网

带有合并的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]
但是如果我在合并之前按名称排序,我会得到9
lop
,而不是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被搁置的情况下,您的遍历也不起作用, Orthor()/代码>将失败,因为您引用的代码可能不存在于<代码>()(< /代码>调制器)中。所以你需要用不同的方式来解释:

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()

这似乎很管用。

你是个天才