Skip to content

[Bug] gremlin查询结果不符合预期 #1900

Closed

Description

@Ckuangf

Bug Type (问题类型)

gremlin (结果不合预期)

Before submit

  • 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题

Environment (环境信息)

  • Server Version: v0.11.x
  • Backend: RocksDB x nodes, HDD or SSD
  • OS: xx CPUs, xx G RAM, Centos 7.x
  • Data Size: xx vertices, xx edges

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

实际上在一度查询时正常,二度查询时只能查出来单条路径:
使用数据 huge中构造的点边数据如下:
image
二度查询时,只能查询出来第二条路径:
image
一度查询时,可以查询出来路径一和路径二
image

期望可以正常查询出2条路径

实际上通过gremliny验证gremlin语句时:
一度查询:
image
二度查询 两条结果正常查询出来:
image

gremliny地址:
https://gremlify.com/ida02brvl5/1
gremliny 构造数据:
g.addV('Vertex').as('1').
addV('Vertex').as('2').
addV('Vertex').as('3').
addV('Vertex').as('4').
addE('child').from('1').to('2').addE('child').
from('2').to('3').addE('child').from('4').
to('3')
查询语句:
g.V(2853).repeat(inE("child").outV().simplePath()).until(or(inE().count().is(0),loops().is(eq(2)))).path()

任意类似的点边关系在huge中查询结果一致,二度查询时均会缺失只有一度结果那条路径

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

No response

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

No response

Activity

  1. imbajin commented on Jun 13, 2022

    @imbajin
    Member

    感谢提供信息, 有试过用 kneighbor 接口 (POST 版, 可带 path) 尝试查询2度路径, 看看是否也有同样问题么?

    另外版本是最新的 0.12-release 么

  2. Ckuangf commented on Jun 13, 2022

    @Ckuangf
    Author

    感谢提供信息, 有试过用 kneighbor 接口 (POST 版, 可带 path) 尝试查询2度路径, 看看是否也有同样问题么?

    另外版本是最新的 0.12-release 么

    使用的是0.11.2版本, 有试过用 kneighbor 接口 (POST 版, 可带 path) 这个接口指的是使用restAPI进行查询的接口么

  3. imbajin commented on Jun 13, 2022

    @imbajin
    Member

    是的, 可以用 rest-api 里的对比一下, 可以更快排除和定位问题 (当然基于最新server是更好)

  4. javeme commented on Jun 13, 2022

    @javeme
    Contributor

    请使用规范的Gremlin语句查询:

    // 注意是 `inE().count().is(0)`,而非 `inE().is(0)`
    g.V(3).repeat(inE('child').outV().simplePath())
          .until(or(inE().count().is(0),loops().is(eq(2))))
          .path()

    整理了一下示例数据:

    schema=graph.schema();
    schema.vertexLabel('node').useCustomizeNumberId().create();
    schema.edgeLabel('child').sourceLabel('node').targetLabel('node').create();
    
    g.addV('node').property(id, 1).as('1')
     .addV('node').property(id, 2).as('2')
     .addV('node').property(id, 3).as('3')
     .addV('node').property(id, 4).as('4')
     .addE('child').from('1').to('2')
     .addE('child').from('2').to('3')
     .addE('child').from('4').to('3')
  5. javeme commented on Jun 13, 2022

    @javeme
    Contributor

    我这边使用inE().count().is(0)方式的查询结果如下:

    {
        "requestId": "32f89c6f-a8cf-4717-baed-0a8631684adf",
        "status": {
            "message": "",
            "code": 200,
            "attributes": {
            }
        },
        "result": {
            "data": [
                {
                    "labels": [],
                    "objects": [
                        {
                            "id": 3,
                            "label": "node",
                            "type": "vertex",
                            "properties": {
                            }
                        },
                        {
                            "id": "L4>1>>L3",
                            "label": "child",
                            "type": "edge",
                            "outV": 4,
                            "outVLabel": "node",
                            "inV": 3,
                            "inVLabel": "node",
                            "properties": {
                            }
                        },
                        {
                            "id": 4,
                            "label": "node",
                            "type": "vertex",
                            "properties": {
                            }
                        }
                    ]
                },
                {
                    "labels": [],
                    "objects": [
                        {
                            "id": 3,
                            "label": "node",
                            "type": "vertex",
                            "properties": {
                            }
                        },
                        {
                            "id": "L2>1>>L3",
                            "label": "child",
                            "type": "edge",
                            "outV": 2,
                            "outVLabel": "node",
                            "inV": 3,
                            "inVLabel": "node",
                            "properties": {
                            }
                        },
                        {
                            "id": 2,
                            "label": "node",
                            "type": "vertex",
                            "properties": {
                            }
                        },
                        {
                            "id": "L1>1>>L2",
                            "label": "child",
                            "type": "edge",
                            "outV": 1,
                            "outVLabel": "node",
                            "inV": 2,
                            "inVLabel": "node",
                            "properties": {
                            }
                        },
                        {
                            "id": 1,
                            "label": "node",
                            "type": "vertex",
                            "properties": {
                            }
                        }
                    ]
                }
            ],
            "meta": {
            }
        }
    }
    
  6. Ckuangf commented on Jun 14, 2022

    @Ckuangf
    Author

    感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions