Open paul-shannon opened 4 years ago
Experiencing same issue when I try to return more than 1 variable form a query
Probably a little late but I've found the best way around this is to not apply any function to what you return. I've had trouble with using collect(user_id), distinct(id) etc etc It works for me when I return full results and then in post-processing I extract exactly what I need
For anyone reading this later -- a potential workaround is to set output = "json"
. This will reveal to you that the arrays of the output are not of uniform length.
For example, this is a valid Neo4j query, but it fails in neo4r
:
# fails in Neo4r 0.1.3
"
CALL gds.louvain.write('GoT', {
writeProperty: 'community'
})
" %>% call_neo4j(con)
If you add change the output type to JSON, then the query will succeed.
"
CALL gds.louvain.write('GoT', {
writeProperty: 'community'
})
" %>% call_neo4j(con, output="json")
Another option is to return a single value to suppress the error.
"
CALL gds.louvain.write('GoT', {
writeProperty: 'community'
})
YIELD communityCount
" %>% call_neo4j(con)
Yet another workaround can be to join your collect
statement into a string. For example:
match (p:Person)
return p.community as Community,
apoc.text.join(collect(p.name), ', ') as Members
fails in neo4r with this message:
The same query, copy & pasted into the neo4j browser returns: