apache / apache/hugegraph

Forget to de-duplicate when there are multiple Predicates in the Gremlin API not()

Open
#1,976 1 comment 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 (问题类型)

_No response_

### 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 (期望与实际表现)

We create two vertices with the following code.

```
schema.propertyKey("vp0").asInt().ifNotExist().create();
schema.vertexLabel("vl0").properties("vp0").nullableKeys("vp0").create();
schema.indexLabel("vl0Byvp0").onV("vl0").by("vp0").shard().ifNotExist().create();
Vertex v1 = new Vertex("vl0").property("vp0", 1);
Vertex v2 = new Vertex("vl0").property("vp0", 2);
```

We execute the query `g.V().has('vl0', 'vp0', not(neq(1).and(gte(2)))).count()`. The expected result is `1`, because only the vertex `v1` satisfies this condition. However, we get a wrong result `2`.

The issue maybe caused by the API `not()` that does not perform the de-duplication operation correctly.

Actuall, we can retrieve the correct result with the query `g.V().hasLabel('vl0').where(values('vp0').is(not(neq(1).and(gte(2)))))`.

### 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.