apache / apache/hugegraph

Outside() API can not process boolean value

Open
#1,595 3 comments 0 reactions 0 assignees View on GitHub
bug gremlin wontfix
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.11.2
- Backend: Memory
- OS: 16 CPUs, 64 G RAM, windows10 WSL
- Data Size: 200 vertices, 100 edges

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

#### Expected behavior
We executed the query “ g.V().has('person', 'married', outside(true, true))”, and expected to get the vertices whose property ‘married’ was FALSE.
#### Actual behavior
An exception was thrown:
```
java.lang.NumberFormatException: Error encountered evaluating script: g.V().has('person', 'married', outside(true, true))
at com.baidu.hugegraph.exception.ServerException.fromResponse(ServerException.java:47)
at com.baidu.hugegraph.client.RestClient.checkStatus(RestClient.java:93)
at com.baidu.hugegraph.rest.AbstractRestClient.post(AbstractRestClient.java:198)
at com.baidu.hugegraph.rest.AbstractRestClient.post(AbstractRestClient.java:172)
at com.baidu.hugegraph.api.gremlin.GremlinAPI.post(GremlinAPI.java:41)
at com.baidu.hugegraph.driver.GremlinManager.execute(GremlinManager.java:51)
at com.baidu.hugegraph.api.gremlin.GremlinRequest$Builder.execute(GremlinRequest.java:55)
at org.gdbtesting.hugegraph.HugeGraphConnection.main(HugeGraphConnection.java:296)
Caused by: [java.lang.NumberFormatException]
```
#### Example to reproduce
```
hugegraph.schema().propertyKey("married").asBoolean().ifNotExist().create();

hugegraph.schema().vertexLabel("person").properties("married").nullableKeys("married").create();
hugegraph.schema().indexLabel("personbymarried").onV("person").by("married").shard().ifNotExist().create();

GraphManager graph = hugegraph.graph();

Vertex person1 = new Vertex("person").property("married", true);
Vertex person2 = new Vertex("person").property("married", false);
Vertex person3 = new Vertex("person").property("married", false);
Vertex person4 = new Vertex("person").property("married", false);

graph.addVertices(Arrays.asList(person1, person2, person3, person4));

GremlinManager gremlin = hugegraph.gremlin();

String query0 = "g.V().has('person', 'married', outside(true, true))";
System.out.println("query0 : " + query0);
try{
ResultSet hugeResult = gremlin.gremlin(query0).execute();
Iterator huresult = hugeResult.iterator();
huresult.forEachRemaining(result -> {
Object object = result.getObject();
System.out.println(object);
});
}catch(Exception e){
e.printStackTrace();
}
```
The code and query of same logic will not cause exception in other gremlin-based graph databases.

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

_No response_

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

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.