Skip to content

A logic bug caused by the combined use of return and match. #3240

@sjhhh321

Description

@sjhhh321

Redis version: redis-7.2.4
RedisGraph version: redisgraph-2.12.10
Operating system: Ubuntu 20.04

Q1:MATCH (n0 :L2)-[r0 :T2]->(n1 :L5)<-[r1 :T0]-(n2 :L5), (n3 :L1)<-[r2 :T4]-(n2), (n2 :L5)-[r3 :T4]->(n2)<-[r4 :T5]-(n4), (n5)-[r5 :T3]->(n0)-[r6 :T2]->(n6 :L1), (n7 :L6)-[r7 :T6]->(n8)<-[r8 :T3]-(n0) MATCH (n5)-[]->(n0)-[]->(n6) MATCH (n7)-[]->(n8)<-[]-(n0 :L2) RETURN (r6.k53) AS a0;
result: "-1244708350"

Q2:MATCH (n8)<-[r8 :T3]-(n0 :L2)<-[r5 :T3]-(n5), (n7 :L6)-[r7 :T6]->(n8), (n3 :L1)<-[r2 :T4]-(n2 :L5)<-[r4 :T5]-(n4), (n2 :L5)<-[r3 :T4]-(n2 :L5)-[r1 :T0]->(n1 :L5), (n1 :L5)<-[r0 :T2]-(n0 :L2)-[r6 :T2]->(n6 :L1) MATCH (n5)-[]->(n0),(n0)-[]->(n6) MATCH (n7)-[]->(n8)<-[]-(n0 :L2) RETURN (r6.k53) AS a0;
result: null
Q1 and Q2 is equivalent query, so the result should be same. But now the results of these two queries are inconsistent. We analyzed that this bug is jointly caused by the match rewriting and the use of return afterwards.

database:

database.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions