RedisGraph Full Text Search UNION Returns Duplicates

Created on 12 May 2021  路  2Comments  路  Source: RedisGraph/RedisGraph

Hello,

I believe I have encountered a bug, but I am posting here to be sure.

Below I am listing my query as well as the results.
You will notice here that I made a full text index on both movie and actor. In this query, I am matching both of these separately, but in each case I am trying to return the movie as well as its neighboring nodes (ie, I match the actor and return the neighboring movie(s) ).
You can see that this works property, and in both cases I am returning identical results.
However, if you inspect the query you will see that I am UNION ing the two different return clauses. Therefore, this query should only return one result. Ie, the UNION is not appropriately deduplicating, despite the 2 return results having identical columns and fields.
Hoping you can advise, thank you!

GRAPH.QUERY "mam" "CALL db.idx.fulltext.queryNodes('movie', 'batman*') YIELD node MATCH q=(m:movie {mamId:node.mamId})-[*0..1]->(n) WHERE NOT (n)-[]->() RETURN m, COLLECT(NODES(q)), COLLECT(RELATIONSHIPS(q))

\nUNION\n

CALL db.idx.fulltext.queryNodes('actor', 'batman') YIELD node match p=(a:actor {name:node.name})-[:hasActor]-(m:movie)-[*0..1]->(n) match q=(m:movie)-[*0..1]->(n) WHERE NOT (n)-[]->() RETURN m, COLLECT(NODES(q)), COLLECT(RELATIONSHIPS(q))"

1) 1) "m"
   2) "COLLECT(NODES(q))"
   3) "COLLECT(RELATIONSHIPS(q))"
2) 1) 1) 1) 1) "id"
            2) (integer) 105
         2) 1) "labels"
            2) 1) "movie"
         3) 1) "properties"
            2)  1) 1) "wecastMamId"
                   2) "wecast|14"
                2) 1) "vendorMamId"
                   2) "413083957"
                3) 1) "title"
                   2) "Batman v Superman: Dawn of Justice"
                4) 1) "description"
                   2) "Fearing that the actions of Superman are left unchecked, Batman takes on the Man of Steel, while the world wrestles with what kind of a hero it really needs."
                5) 1) "releaseDate"
                   2) "2016-02-01T00:00:00+00:00"
                6) 1) "status"
                   2) "Active"
                7) 1) "lastModified"
                   2) "2021-05-11T21:46:42Z"
                8) 1) "bundleId"
                   2) "cft-Xo82SYC00"
                9) 1) "year"
                   2) "2016"
               10) 1) "created"
                   2) "2021-05-11T21:45:45Z"
               11) 1) "version"
                   2) (integer) 2
               12) 1) "mamId"
                   2) "movie|siden|105"
      2) "[[(105), (760)], [(105), (759)], [(105), (758)], [(105), (757)], [(105), (756)], [(105), (755)], [(105), (754)], [(105), (753)], [(105), (752)], [(105), (111)], [(105), (110)], [(105), (109)], [(105), (108)], [(105), (107)], [(105), (106)], [(105), (72)], [(105), (60)]]"
      3) "[[[871]], [[870]], [[869]], [[868]], [[867]], [[866]], [[865]], [[864]], [[863]], [[41]], [[40]], [[39]], [[38]], [[37]], [[36]], [[35]], [[34]]]"
   2) 1) 1) 1) "id"
            2) (integer) 105
         2) 1) "labels"
            2) 1) "movie"
         3) 1) "properties"
            2)  1) 1) "wecastMamId"
                   2) "wecast|14"
                2) 1) "vendorMamId"
                   2) "413083957"
                3) 1) "title"
                   2) "Batman v Superman: Dawn of Justice"
                4) 1) "description"
                   2) "Fearing that the actions of Superman are left unchecked, Batman takes on the Man of Steel, while the world wrestles with what kind of a hero it really needs."
                5) 1) "releaseDate"
                   2) "2016-02-01T00:00:00+00:00"
                6) 1) "status"
                   2) "Active"
                7) 1) "lastModified"
                   2) "2021-05-11T21:46:42Z"
                8) 1) "bundleId"
                   2) "cft-Xo82SYC00"
                9) 1) "year"
                   2) "2016"
               10) 1) "created"
                   2) "2021-05-11T21:45:45Z"
               11) 1) "version"
                   2) (integer) 2
               12) 1) "mamId"
                   2) "movie|siden|105"
      2) "[[(105), (760)], [(105), (759)], [(105), (758)], [(105), (757)], [(105), (756)], [(105), (755)], [(105), (754)], [(105), (753)], [(105), (752)], [(105), (111)], [(105), (110)], [(105), (109)], [(105), (108)], [(105), (107)], [(105), (106)], [(105), (72)], [(105), (60)]]"
      3) "[[[871]], [[870]], [[869]], [[868]], [[867]], [[866]], [[865]], [[864]], [[863]], [[41]], [[40]], [[39]], [[38]], [[37]], [[36]], [[35]], [[34]]]"
bug

All 2 comments

Hi @sidenAlex, thank you for reporting!
this is indeed a bug,

here's a simpler recreation example:

GRAPH.QUERY g "CREATE ({v:1})"

GRAPH.query g "MATCH (n) RETURN n.v UNION MATCH (n), (z) RETURN n.v"
1) 1) "n.v"
2) 1) 1) (integer) 1
   2) 1) (integer) 1

@sidenAlex, fix has been merged to our master branch, should be available shortly in our edge docker image (make sure your local docker cache is clear before pulling) docker run -p 6379:6379 -it --rm redislabs/redisgraph:edge
could you please verify?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sidenAlex picture sidenAlex  路  3Comments

kkonevets picture kkonevets  路  3Comments

dandago picture dandago  路  3Comments

bingo-ctrl picture bingo-ctrl  路  4Comments

fantasticKe picture fantasticKe  路  5Comments