apache / apache/hugegraph

Executing bothV().bothE() without HugeVertexStepStrategy misses edges and edge properties

Open
#2,129 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
3.2k
Forks
636
Avg merge
3d 11h
Merged PRs (30d)
14

Description

### Bug Type (问题类型)

gremlin (结果不合预期)

### Before submit

- [X] 我已经确认现有的 [Issues](https://github.com/hugegraph/hugegraph/issues) 与 [FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有相同 / 重复问题

### Environment (环境信息)

- Server Version: v0.12.0
- Backend: in memory
- OS: xx CPUs, xx G RAM, Centos 7.x
- Data Size: xx vertices, xx edges

### Expected & Actual behavior (期望与实际表现)

When I execute the query `g.E().bothV().bothE()` without HugeVertexStepStrategy, it omits some edges and misses some properties of edges. Specifically, the expected result is `{e1, e1, e1, e2, e2, e2}`, but it returns `{e2, e2, e2, e1}` and two of edge `e2` miss their edge properties.

```
gremlin> :>hugegraph.traversal().withoutStrategies(HugeVertexStepStrategy).E().bothV().bothE()
==>[id:L694595900512665602>2>>L694595900512665600,label:teach,type:edge,outV:694595900512665602,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:2]]
==>[id:L694595900512665602>2>>L694595900512665600,label:teach,type:edge,outV:694595900512665602,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[]]
==>[id:L694595900512665602>2>>L694595900512665600,label:teach,type:edge,outV:694595900512665602,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[]]
==>[id:L694595900512665601>1>>L694595900512665600,label:knows,type:edge,outV:694595900512665601,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:3]]

gremlin> :> hugegraph.traversal().E().bothV().bothE()
==>[id:L694595900512665602>2>>L694595900512665600,label:teach,type:edge,outV:694595900512665602,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:2]]
==>[id:L694595900512665601>1>>L694595900512665600,label:knows,type:edge,outV:694595900512665601,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:3]]
==>[id:L694595900512665601>1>>L694595900512665600,label:knows,type:edge,outV:694595900512665601,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:3]]
==>[id:L694595900512665602>2>>L694595900512665600,label:teach,type:edge,outV:694595900512665602,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:2]]
==>[id:L694595900512665602>2>>L694595900512665600,label:teach,type:edge,outV:694595900512665602,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:2]]
==>[id:L694595900512665601>1>>L694595900512665600,label:knows,type:edge,outV:694595900512665601,outVLabel:person,inV:694595900512665600,inVLabel:person,properties:[year:3]]

```

I create three vertices and two edges as following.

```
hugegraph.schema().propertyKey("age").asInt().ifNotExist().create();
hugegraph.schema().propertyKey("year").asInt().ifNotExist().create();

// vertex
hugegraph.schema().vertexLabel("person").properties("age").nullableKeys("age").create();
hugegraph.schema().indexLabel("personbyage").onV("person").by("age").shard().ifNotExist().create();

// edge
hugegraph.schema().edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("year").ifNotExist().create();
hugegraph.schema().edgeLabel("teach").sourceLabel("person").targetLabel("person").properties("year").ifNotExist().create();
hugegraph.schema().indexLabel("knowsbyperson").onE("knows").by("year").shard().ifNotExist().create();
hugegraph.schema().indexLabel("teachbyperson").onE("teach").by("year").shard().ifNotExist().create();

GraphManager graph = connection.getHugespecial().graph();

/** create graph data */
Vertex person1 = new Vertex("person").property("age", 12);
Vertex person2 = new Vertex("person").property("age", 23);
Vertex person3 = new Vertex("person").property("age", 24);

graph.addVertices(Arrays.asList(person1, person2, person3));

Edge edge1 = new Edge("knows").source(person2).target(person1).property("year", 3);
Edge edge2 = new Edge("teach").source(person3).target(person1).property("year", 2);
graph.addEdges(Arrays.asList(edge1, edge2));
```

### Vertex/Edge example (问题点 / 边数据举例)

_No response_

### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.