GraphScope icon indicating copy to clipboard operation
GraphScope copied to clipboard

Return the original vertex(edge) id during gremlin query

Open lidongze0629 opened this issue 3 years ago • 8 comments

Is your feature request related to a problem? Please describe.

From the results of Gremlin query, it seems that the internal ID is returned, which is very confusing for users because cannot correspond to the original data.

# case 1
>>> client.submit("g.V()").all().result()
[v[0.-9223372036854774811],
 v[0.-9223372036854774810],
 v[0.-9223372036854774809],
 ...]

# case2
>>> client.submit("g.V(1)").all().result()
[v[0.1]]

# case3
>>> client.submit("g.V(1).bothE()").all().result()
[e[-9223372036854756121][0.-9223372036854754957-e0->0.1],
 e[73273][0.1-e0->0.-9223372036854760078],
 e[73276][0.1-e0->0.-9223372036854758343],
 e[73278][0.1-e0->0.-9223372036854758342]]

Describe the solution you'd like Return original vertex(edge) id during gremlin query

lidongze0629 avatar Apr 19 '22 09:04 lidongze0629

For modern graph dataset:

# cat person.csv (vertex)
id|name|age
2|vadas|27
6|peter|35
4|josh|32
1|marko|29

# cat knows.csv (edge)
src_id|dst_id|weight
1|2|0.5
1|4|1.0

Compared with the standard gremlin results

1. gremlin results 截屏2022-04-20 上午11 15 09

2. GraphScope results 截屏2022-04-20 上午11 16 06

lidongze0629 avatar Apr 20 '22 03:04 lidongze0629

Close issue as fixed in GAIA.

lidongze0629 avatar Apr 20 '22 03:04 lidongze0629

Reopen by waiting for confirm in GAIA

lidongze0629 avatar Apr 27 '22 02:04 lidongze0629

@longbinlai Dongze reports this issue remains in GAIA.

yecol avatar May 20 '22 02:05 yecol

g.V().out().values("id") // 属性id,
g.V().out().values("~id") // 系统生成的global unique id,默认输出为global unique id

longbinlai avatar May 20 '22 03:05 longbinlai

@longbinlai Hi, longbin,返回 id 的这里,是不是我们像标准的 TinkerPop Gremlin Server 一样默认返回 属性 id 比较好呢?而不是返回用户不可知的 global unique id

GAIA_IR 的结果如下:

miKrlsY8yMDIyLTA1LTE3IOS4i+WNiDguNTEuNDEucG5n miKrlsY8yMDIyLTA1LTE3IOS4i+WNiDkuMDcuMDMucG5n

lidongze0629 avatar May 20 '22 03:05 lidongze0629

@lidongze0629 首先,gremlin也不是返回属性id,而是global unique id,你举的这个例子是刚好global unique id = 属性id了,这个是他modern graph里做了一些hack导致的;其次,只有返回global id才能保证用户拿这个id去查到确定的对象,因为他是全局唯一的,属性id并不能保证全局唯一。可能在这个很小的示例里这个属性id也是unique的,但是稍微大一点就会发现我们可以specify person id = 2,也可以post id = 2, 所以拿这个属性id去查会得到多个点;最后,属性id其实可以很容易通过values("id") 去拿到。

longbinlai avatar May 20 '22 03:05 longbinlai

好的,多谢解答,了解了。

lidongze0629 avatar May 20 '22 03:05 lidongze0629