apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
https://hugegraph.apache.org
Apache License 2.0
2.63k stars 517 forks source link

Error occurred when querying properties using where() if the data has INFINITY #2189

Open zhengyingying opened 1 year ago

zhengyingying commented 1 year ago

Bug Type (问题类型)

gremlin (结果不合预期)

Before submit

Environment (环境信息)

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

I create two vertices.

Vertex product1 = new Vertex("product").property("name", "product1").property("price", 3.254615);
Vertex product2 = new Vertex("product").property("name", "product2").property("price", new Double(1029.98 / 0));

When I query property price using where(), it throws an exception, while I can query the correct result using has().

gremlin> :> hugegraph.traversal().V().where(values('price').is(eq(3.254615)))
java.lang.NumberFormatException

gremlin> :> hugegraph.traversal().V().has('price',3.254615)
==>[id:707955786323591168,label:product,type:vertex,properties:[name:product1,price:3.254615]]

When I drop vertex product2, I can get the correct result.

gremlin> :> hugegraph.traversal().V(707955786323591169).drop()

gremlin> :> hugegraph.traversal().V().where(values('price').is(eq(3.254615)))
==>[id:707955786323591168,label:product,type:vertex,properties:[name:product1,price:3.254615]]

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

No response

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

No response

zhengyingying commented 1 year ago

Hi, I find a similar bug in the following test case, where the exception is thrown when we remove the FilterRankingStrategy. I think the root cause is the same as the above test case.

gremlin> :> hugegraph.traversal().V().where(values('price').is(inside(0.793811421704601, 1.345171808E9))).has('price', 3.254615)
==>[id:712320049687298049,label:product,type:vertex,properties:[name:product1,price:3.254615]]
gremlin> :> hugegraph.traversal().withoutStrategies(FilterRankingStrategy).V().where(values('price').is(inside(0.793811421704601, 1.345171808E9))).has('price', 3.254615)
java.lang.NumberFormatException

I can get the correct result in TinkerGraph. So can it be confirmed as a real bug?

javeme commented 1 year ago

Thanks for your report, we need to improve it.