apache / apache/hugegraph

[Bug] count() is not de-duplicated

Open
#1,734 4 comments 0 reactions 0 assignees View on GitHub
bug gremlin improvement
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: memory
- OS: ubuntu 8 CPUs, 32 G RAM
- Data Size: 5000vertices, 10000 edges

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

when i was querying overlapping fields, duplicate results were not de-duplicated by "count()". the query is "String query = “g.V().has('length', between(-433,2678).or(lte(500))).count()”;"

### Example to reproduce:
```
hugegraph.schema().vertexLabel("type").properties("length").nullableKeys("length").create(); hugegraph.schema().indexLabel("typebylength").onV("type").by("length").shard().ifNotExist().create();

Vertex v1 = new Vertex("type").property("length", 546);
Vertex v2 = new Vertex("type").property("length", 1);
Vertex v3 = new Vertex("type").property("length", 3000);

graph.addVertices(Arrays.asList(v1 , v2 , v3));

String query = “g.V().has('length', between(-433,2678).or(lte(500))).count()”;
```
### Expected: return 2
### Actual behavior: return 3

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

```javascript
No response
```

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

```javascript
No response
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided schema, vertices, and Gremlin query against HugeGraph v0.12.0 using the memory backend. Trace how the overlapping `between(...).or(lte(...))` condition is processed before `count()`. Done means the example returns 2 rather than 3, with regression coverage for the query behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.