redisgraph.js icon indicating copy to clipboard operation
redisgraph.js copied to clipboard

node redisGraphExample.js TypeError: row.split is not a function

Open marcoippolito opened this issue 6 years ago • 4 comments

In my Ubuntu 18.04.01 Server Edition I git cloned redisgraph.js and tested it:

marco@pc01:~/redisgraph.js$ npm test

> [email protected] test /home/marco/redisgraph.js
> mocha --exit

  RedisGraphAPI Test
    ✓ test bring your client
    ✓ test Create Node
    ✓ test Create Labeled Node
    ✓ test Connect Nodes
    ✓ test Query
{"id":0,"label":"person","properties":{"age":34,"name":"roi"}}
{"id":0,"relation":"knows","srcNode":0,"destNode":1,"properties":   
{"nullValue":null,"boolValue":false,"doubleValue":3.14,"since":2000,"place":"TLV"}}
    ✓ test query full entity
    ✓ test multi thread

  7 passing (16ms)

But when running the example:

marco@pc01:~/redisgraph.js/examples$ ls -lah
total 24K
drwxrwxr-x 3 marco marco 4.0K May 29 18:00 .
drwxrwxr-x 8 marco marco 4.0K May 29 17:59 ..
drwxr-xr-x 7 root  root  4.0K May 29 18:00 node_modules
-rw-r--r-- 1 root  root  1.4K May 29 18:00 package-lock.json
-rw-rw-r-- 1 marco marco  325 May 29 17:58 package.json
-rw-rw-r-- 1 marco marco  687 May 29 17:58 redisGraphExample.js

marco@pc01:~/redisgraph.js/examples$ node redisGraphExample.js 
TypeError: row.split is not a function
    at Statistics.getStatistics (/home/marco/redisgraph.js/examples/node_modules/redisgraph.js
/src/statistics.js:21:22)
    at Statistics.getStringValue (/home/marco/redisgraph.js/examples/node_modules
/redisgraph.js/src/statistics.js:9:15)
    at Statistics.getFloatValue (/home/marco/redisgraph.js/examples/node_modules
/redisgraph.js/src/statistics.js:35:20)
    at Statistics.queryExecutionTime (/home/marco/redisgraph.js/examples/node_modules
/redisgraph.js/src/statistics.js:64:15)
    at graph.query.then.then.then.then.res (/home/marco/redisgraph.js/examples
/redisGraphExample.js:23:35)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

Any hints to solve the problem? Marco

marcoippolito avatar May 29 '19 18:05 marcoippolito

Hi Marco please provide the version of RedisGraph that you are using and the monitor output from redis-cli when executing the example file (by typing "monitor" in redis-cli)

DvirDukhan avatar Jun 06 '19 12:06 DvirDukhan

Great project! Really neat idea.

Unfortunately I'm getting this as well. It's because the result set is empty, despite the data existing in RedisGraph when I check it manually. So it's really two problems:

  1. the README.md example doesn't work when copied exactly
  2. when no results are returned, statistics has a type problem.

Here's the output of the monitor:

OK
1564964658.434936 [0 172.17.0.1:45280] "info"

1564964658.437797 [0 172.17.0.1:45280] "graph.query" "social" "CREATE (:person{name:'roi',age:32})"

1564964658.440237 [0 172.17.0.1:45280] "graph.query" "social" "CREATE (:person{name:'amit',age:30})"

1564964658.441493 [0 172.17.0.1:45280] "graph.query" "social" "MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)"

1564964658.442706 [0 172.17.0.1:45280] "graph.query" "social" "MATCH (a:person)-[:knows]->(:person) RETURN a"

Using docker: redislabs/redisgraph:latest

redis version: 5.0.5 (00000000/0) 64 bit

redis graph version: 19900

renewooller avatar Aug 05 '19 00:08 renewooller

FYI, I found that it works when I set the docker image to 1.2.2 as per https://github.com/RedisGraph/redisgraph-py/issues/40

It looks like statistics have been added, but the clients don't deal with them.

Is there a way to silence the statistics?

Cheers, Rene

renewooller avatar Aug 05 '19 01:08 renewooller

Hi @renewooller. Thanks for the input. I have tested this issue with the latest versions of RedisGraph and RedisGraph.js and it is working as expected. The current default version of RedisGraph.js which found in NPM is not supporting the new resultset structure featured in newer versions of RedisGraph. you can either use older versions as you did with 1.2.2 or use the latest version of RedisGraph.js. by

  1. npm install git+https://[email protected]:RedisGraph/redisgraph.js.git
  2. change your package.json file to include this dependency: "dependencies": { "redisgraph": "git+https://[email protected]:RedisGraph/redisgraph.js.git", },

Note: the usage is a bit different then the example, mainly names. You can look at the test file for reference

DvirDukhan avatar Aug 05 '19 08:08 DvirDukhan