Disclaimer: I'm one of the RedisGraph engineers.
First, for the time being, we do not support maps as a native datatype in RedisGraph so, unfortunately, your query is currently not supported.
Second, Can you please share which version of RedisGraph are you using? I executed the following code over our latest docker image (docker run -p 6379:6379 --rm redislabs/redisgraph:latest
)
@Test
public void testStackOverflowQuestion(){
RedisGraph graph = new RedisGraph();
Map<String, Object> props = new HashMap<>();
props.put("id", 2);
props.put("name", "Jagadeesh");
props.put("age", 23);
graph.query("UserGraph", "CREATE ($props)", props);
}
and the response seems to be more appropriate for unsuppoted data types:
com.redislabs.redisgraph.exceptions.JRedisGraphCompileTimeException: redis.clients.jedis.exceptions.JedisDataException: Encountered unhandled type in inlined properties.
Edit after comment:
I modify the test to be
@Test
public void testStackOverflowQuestion(){
RedisGraph graph = new RedisGraph();
Map<String, Object> personMap = new HashMap<>();
personMap.put("id", 2);
personMap.put("name", "Jagadeesh");
personMap.put("age", 23);
Map<String, Object> props = new HashMap<>();
props.put("props", personMap);
graph.query("UserGraph", "CREATE ($props)", props);
}
I got the same response as you as you.
This is our parser error. Our parser expects map key-value pair to be seperated by colon key:value
The error caused by wrong format of serialization of the map object in JRedisGraph which currently calls the map toString()
method which serializes it as key = value
so our parser skips the parameter parsing and treats the map as part of the actual query.
By applying MONITOR
in redis-cli, your query yields the command:
"graph.QUERY" "UserGraph" "CYPHER props={name=Jagadeesh, id=2, age=23} CREATE ($props)" "--COMPACT"
As you can see, the map is sent in key=value
format.
I manually changed the query and sent it in redis-cli with key:value
format and got the expected response:
127.0.0.1:6379> graph.query g "CYPHER props={name:Jagadeesh, id:2, age:23} CREATE ($props)"
(error) Encountered unhandled type in inlined properties.