Insertion of vertex with composite-indexed property fails due to type check assertion


Jason Plurad <plu...@...>
 

Sounds fair enough to me. Feel free to open up an issue and pull request. Contributions are welcome.


On Thursday, December 14, 2017 at 3:38:53 AM UTC+11, rainer.pic wrote:
Hello,

I stumbled into an issue with composite indices and data types: It happens when inserting a vertex with an indexed property that has the schema-defined type of "Object". With Java assertions ("-ea" flag) enabled, the insertion fails due to a failing assertion. However, with Java assertions disabled, the insertion works and queries seem to utilize the index correctly.

While I am still on JanusGraph 0.1.1, the affected assertion still exists in the master branch (IndexSerializer.java, line 492):
PropertyKey key;
JanusGraphVertexProperty p;
assert key.dataType().equals(p.value().getClass()) : key + " -> " + p;

In my case the actual property value is of type "String", while the schema is typed to "Object" (on purpose). Clearly, this does not match and thus, the assertion fails.

According to documentation: "JanusGraph’s composite indexes support any data type that can be stored in JanusGraph" (http://docs.janusgraph.org/latest/search-predicates.html)

I would expect that the assertion should only check for "actualValue instanceOf schemaDataType".
Hence, I would like to know whether this is a bug or whether there is more to it that I do not see?

-Rainer Pichler
https://twitter.com/rainerpichler


rain...@...
 

Hello,

I stumbled into an issue with composite indices and data types: It happens when inserting a vertex with an indexed property that has the schema-defined type of "Object". With Java assertions ("-ea" flag) enabled, the insertion fails due to a failing assertion. However, with Java assertions disabled, the insertion works and queries seem to utilize the index correctly.

While I am still on JanusGraph 0.1.1, the affected assertion still exists in the master branch (IndexSerializer.java, line 492):
PropertyKey key;
JanusGraphVertexProperty p;
assert key.dataType().equals(p.value().getClass()) : key + " -> " + p;

In my case the actual property value is of type "String", while the schema is typed to "Object" (on purpose). Clearly, this does not match and thus, the assertion fails.

According to documentation: "JanusGraph’s composite indexes support any data type that can be stored in JanusGraph" (http://docs.janusgraph.org/latest/search-predicates.html)

I would expect that the assertion should only check for "actualValue instanceOf schemaDataType".
Hence, I would like to know whether this is a bug or whether there is more to it that I do not see?

-Rainer Pichler
https://twitter.com/rainerpichler