Skip to content

[Bug] Wrong result for where(count().is() #3085

Description

@choeoe

Bug Type (问题类型)

gremlin (结果不合预期)

Before submit

  • 我已经确认现有的 IssuesFAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version:
    • core: 1.7.0
    • gremlin: 3.5.1
    • api: 0.71.0.0
  • Docker Image: hugegraph/hugegraph:latest
  • Backend: default Docker standalone backend
  • Data Size: 2 vertices, 1 edge

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

HugeGraph returns wrong results when a where() child traversal uses count().is(...).

Minimal graph:
(a:A)-[:E]->(b:A)

Bug-triggering query:
g.V('a')
.where(__.both('E').count().is(not(outside(1,18).and(gte(0)))))
.count()

Expected:
[1]

Actual:
[0]

The dual predicate is also wrong:
g.V('a')
.where(__.both('E').count().is(outside(1,18).and(gte(0))))
.count()

Expected:
[0]

Actual:
[1]

For count = 1, outside(1,18) is false, so outside(1,18).and(gte(0)) should be false, and not(...) should be true.

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

**Vertex/Edge example**



curl -fsS --compressed -X DELETE \
  "http://127.0.0.1:8080/graphs/hugegraph/clear?confirm_message=I'm%20sure%20to%20delete%20all%20data"

curl -fsS --compressed -H 'Content-Type: application/json' -X POST \
  -d '{"id":"a","label":"A","properties":{}}' \
  "http://127.0.0.1:8080/graphs/hugegraph/graph/vertices"

curl -fsS --compressed -H 'Content-Type: application/json' -X POST \
  -d '{"id":"b","label":"A","properties":{}}' \
  "http://127.0.0.1:8080/graphs/hugegraph/graph/vertices"

curl -fsS --compressed -H 'Content-Type: application/json' -X POST \
  -d '{"label":"E","outV":"a","outVLabel":"A","inV":"b","inVLabel":"A","properties":{}}' \
  "http://127.0.0.1:8080/graphs/hugegraph/graph/edges"

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

**Schema**



curl -fsS --compressed -H 'Content-Type: application/json' -X POST \
  -d '{"name":"A","id_strategy":"CUSTOMIZE_STRING","properties":[],"nullable_keys":[],"enable_label_index":true}' \
  "http://127.0.0.1:8080/graphs/hugegraph/schema/vertexlabels"

curl -fsS --compressed -H 'Content-Type: application/json' -X POST \
  -d '{"name":"E","source_label":"A","target_label":"A","frequency":"SINGLE","properties":[],"nullable_keys":[],"enable_label_index":true}' \
  "http://127.0.0.1:8080/graphs/hugegraph/schema/edgelabels"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggremlinTinkerPop gremlin

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions