[Question] valueMap()参数binding行为与预期不符
当前java client执行一下语句会报错:
List<String> ret = Lists.newArrayList("name", "age");
ResultSet rs = gremlin.gremlin("g.V().has('name', 'marko').valueMap(ret)").binding("ret", ret).execute();
报错信息为:
com.baidu.hugegraph.exception.ServerException: [Ljava.lang.String; cannot be cast to java.util.List
这与binding的使用预期有点不相符。这个地方的binding是有什么考虑特意设计成这样的吗?还是一个缺陷?
这是由于 groovy 和 java 的类型系统有些不同,List 和 Array 转换时需要额外做一些工作。
可以这么写
GremlinManager gremlin = hugeClient.gremlin();
List<String> ids = Lists.newArrayList("1", "2");
List<String> properties = Lists.newArrayList("演员");
ResultSet resultSet = gremlin.gremlin("def props = properties as String[]; g.V(ids).valueMap(props)")
.binding("ids", ids)
.binding("properties", properties)
.execute();
上面的方式能正常work,但是跟g.V(), with()中的binding参数使用方式不一致,且相对复杂些了,不知道这个地方是否有优化的空间哈?
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label
这个地方,我们的huge可以列入improvement么?我觉得这样对用户使用比较友好些
这个问题不是 huge 兼不兼容的问题,是 List
我理解需要在两个数据类型之间转换一下,这个功能可以在huge内部做兼容处理吗?对用户屏蔽差异。
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label