Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect result when encountering nested expressions #778

Open
Aurora-yzj opened this issue Aug 27, 2024 · 0 comments
Open

Incorrect result when encountering nested expressions #778

Aurora-yzj opened this issue Aug 27, 2024 · 0 comments

Comments

@Aurora-yzj
Copy link

Hi! I discovered a bug in FalkorDB that nested expressions could cause the database gives incorrect result. Steps to reproduce are as follows.

  1. Set the initial data in the DB.
CREATE (n0 {id : 0})
CREATE (n0 :L2:L3{k17 : "fcqlkY", k16 : "P04HQ", k19 : -2118119469, k18 : true, k20 : "6YWdgBM", k22 : true, id : 1, k21 : "mHPKVgu", k12 : -557478845, k23 : false, k14 : true})
CREATE (n0 :L3{k17 : "ohS6bi7", k19 : -1775712585, k18 : false, k20 : "VkyyRvw", k22 : true, k21 : "Rd4CeWku", id : 2, k23 : false})
CREATE (n0 :L2{k16 : "s4PnwW", id : 3, k13 : 564149143, k12 : 606791163, k15 : "KcC3uq", k14 : false})
CREATE (n0 :L2:L0{k0 : "c8ruo", k1 : 1592929360, k2 : -912273009, k3 : "toSHnW", k4 : false, k5 : 951963870, k6 : "g1ska6og", k13 : -103661351, k12 : -522121793, k15 : "8g5n0vuAd", k14 : false, k16 : "2O4GZ", id : 5})
CREATE (n0 :L3{k17 : "HpSEQcH01", k19 : -1462064669, k18 : false, k20 : "v3ks3Wgut", k22 : true, k21 : "l6wfMg", id : 6, k23 : true})
CREATE (n0 :L2:L1{k16 : "pOPTv", k11 : "weJb4", id : 7, k10 : "6jRQzNZ6Z", k13 : -1394813262, k7 : true, k12 : -92205271, k15 : "8V38HVzK", k9 : 357774228, k14 : true})
CREATE (n0 {id : 9})
CREATE (n0 :L3{k17 : "XbyGcb", k19 : -1224991217, k18 : false, k20 : "m1kgbk4Q", k22 : false, k21 : "h1swgJDWQ", id : 10, k23 : false})
CREATE (n0 :L1{k11 : "yFfiz5ET", k10 : "RrGmhPKzT", id : 11, k8 : 539266163, k9 : 2071417233})
MATCH (n0 {id : 0}), (n1 {id : 7}) MERGE(n0)-[r :T10{k95 : "n5VQOC3y", k94 : false, k97 : false, k96 : 1071342041, k99 : -1728485221, k98 : -72485750, id : 15}]->(n1)
MATCH (n0 {id : 5}), (n1 {id : 11}) MERGE(n0)-[r :T14{k121 : false, k120 : -386975946, k122 : true, k116 : -1501533168, id : 16, k118 : 1806520395, k117 : true, k119 : 448810352}]->(n1)
MATCH (n0 {id : 11}), (n1 {id : 1}) MERGE(n0)-[r :T14{k121 : true, k120 : 587000983, k122 : false, k116 : -1816647876, id : 17, k118 : -1946276356, k117 : true, k119 : 227207187}]->(n1)
MATCH (n0 {id : 3}), (n1 {id : 5}) MERGE(n0)-[r :T17{k134 : "jONbz", k136 : "91KUHX", k135 : false, k138 : false, k137 : "o4n2YZ8Mu", id : 18}]->(n1)
MATCH (n0 {id : 1}), (n1 {id : 9}) MERGE(n0)-[r :T12{k105 : "b5dhbH", id : 19, k107 : -2010045927, k106 : true, k109 : true, k108 : false}]->(n1)
MATCH (n0 {id : 7}), (n1 {id : 3}) MERGE(n0)-[r :T1{k42 : false, k44 : false, k43 : "QHhTaNER", id : 20, k46 : 989301226, k45 : true}]->(n1)
MATCH (n0 {id : 2}), (n1 {id : 6}) MERGE(n0)-[r :T2{k49 : false, k51 : -820563566, k50 : false, k53 : "sQHCbY", k52 : true, id : 21, k48 : "AuQsNQUkq", k47 : 1031468300}]->(n1)
MATCH (n0 {id : 10}), (n1 {id : 1}) MERGE(n0)-[r :T2{k49 : false, k51 : 2067606647, k50 : false, k53 : "ehm1rLub3", k52 : true, id : 22, k48 : "fzmcIx7", k47 : 225292182}]->(n1)
  1. Consider the following query with nested expression:
MATCH (n0 :L3)-[r0 :T3]->(n1), (n1)<-[r1 :T12]-(n2 :L2 :L3)<-[r2 :T14]-(n3 :L1{k8:539266163})<-[r3 :T14]-(n4 :L2 :L0)<-[r4 :T17]-(n5 :L2{k13:564149143})<-[r5 :T1]-(n6 :L2 :L1)<-[r6 :T10]-(n7), (n8 :L3)<-[r7 :T2]-(n9 :L3) WHERE (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((n0.k23) = true) AND (((((r2.id) > (n4.k13)) AND (NOT ((r3.k122) = true))) OR ((r6.k96) <= (r6.k96))) AND ((((r7.k50) = true) OR (((n0.k22) = true) AND ((n8.k23) = true))) OR ((((n9.k22) = true) OR ((r3.k122) = true)) AND ((n4.id) > (r3.k120)))))) OR ((((((n5.k15)+(n0.k21))+('yJoiGL'+(n2.k16))) ENDS WITH (n2.k16)) OR (((((n8.k18) = true) AND ((n9.k23) = true)) OR (((n5.k14) = true) AND ((n4.k14) = true))) AND (((r4.k134)+'J1j9G3Td') ENDS WITH 'zJ1j9G3Td'))) AND (((n4.k15) ENDS WITH (n4.k15)) AND (((n8.k22) = true) AND true)))) AND ((r0.id) <> (r1.id))) AND ((r0.id) <> (r2.id))) AND ((r0.id) <> (r3.id))) AND ((r0.id) <> (r4.id))) AND ((r0.id) <> (r5.id))) AND ((r0.id) <> (r6.id))) AND ((r0.id) <> (r7.id))) AND ((r1.id) <> (r0.id))) AND ((r1.id) <> (r2.id))) AND ((r1.id) <> (r3.id))) AND ((r1.id) <> (r4.id))) AND ((r1.id) <> (r5.id))) AND ((r1.id) <> (r6.id))) AND ((r1.id) <> (r7.id))) AND ((r2.id) <> (r0.id))) AND ((r2.id) <> (r1.id))) AND ((r2.id) <> (r3.id))) AND ((r2.id) <> (r4.id))) AND ((r2.id) <> (r5.id))) AND ((r2.id) <> (r6.id))) AND ((r2.id) <> (r7.id))) AND ((r3.id) <> (r0.id))) AND ((r3.id) <> (r1.id))) AND ((r3.id) <> (r2.id))) AND ((r3.id) <> (r4.id))) AND ((r3.id) <> (r5.id))) AND ((r3.id) <> (r6.id))) AND ((r3.id) <> (r7.id))) AND ((r4.id) <> (r0.id))) AND ((r4.id) <> (r1.id))) AND ((r4.id) <> (r2.id))) AND ((r4.id) <> (r3.id))) AND ((r4.id) <> (r5.id))) AND ((r4.id) <> (r6.id))) AND ((r4.id) <> (r7.id))) AND ((r5.id) <> (r0.id))) AND ((r5.id) <> (r1.id))) AND ((r5.id) <> (r2.id))) AND ((r5.id) <> (r3.id))) AND ((r5.id) <> (r4.id))) AND ((r5.id) <> (r6.id))) AND ((r5.id) <> (r7.id))) AND ((r6.id) <> (r0.id))) AND ((r6.id) <> (r1.id))) AND ((r6.id) <> (r2.id))) AND ((r6.id) <> (r3.id))) AND ((r6.id) <> (r4.id))) AND ((r6.id) <> (r5.id))) AND ((r6.id) <> (r7.id))) AND ((r7.id) <> (r0.id))) AND ((r7.id) <> (r1.id))) AND ((r7.id) <> (r2.id))) AND ((r7.id) <> (r3.id))) AND ((r7.id) <> (r4.id))) AND ((r7.id) <> (r5.id))) AND ((r7.id) <> (r6.id))) AND ((((((((((((n0.k20) STARTS WITH 'OpHGm') AND ((n1.id) = 9)) AND ((n1.id) = 9)) AND (((r1.k54) STARTS WITH (n6.k15)) OR ((r1.k54) is  null))) AND ((n2.k17) CONTAINS 'cqlk')) AND (((r2.k119) > 227207186) AND ((r2.k119) < 227207188))) AND (((r5.k46) >= 989301224) AND ((r5.k46) <= 989301227))) AND ((n6.k16) STARTS WITH 'pOP')) AND ((n8.k20) STARTS WITH 'v3ks3Wg')) AND (((r7.k47) > 1031468299) AND ((r7.k47) < 1031468302))) AND ((n9.k20) ENDS WITH 'kyyRvw'))) WITH endNode(r5) AS a0, toBoolean((n5.id)) AS a1 ORDER BY a1 SKIP 0 WHERE (((-53 <= 1219033240) AND (NOT ((false = true) AND (NOT ((false = true) OR (true = true)))))) AND (((('lNn1F'+('yAEiTb'+'I3c7mM9'))+('Jo1Y7jYzU'+('MmaURb7eA'+'U8mhog')))+(('hR6hB5'+'PmEb3')+('NzDmljcl'+'fHlUHBm'))) CONTAINS 'FyAEiTbI3c7mM9Jo1Y7jY')) RETURN DISTINCT toInteger(abs(cos(-100))) AS a1 UNION ALL MATCH (n1)<-[r1]-(n2)<-[r2]-(n3{k10:'RrGmhPKzT'})<-[r3]-(n4)<-[r4]-(n5{k16:'s4PnwW'})<-[r5]-(n6{k11:'weJb4'})<-[r6]-(n7) WHERE true MATCH (n8{k21:'Rd4CeWku'})-[r7]->(n9) WHERE true WITH 21 AS a1 MATCH (n1)<-[r8]-(n2)<-[r9]-(n3)<-[r10]-(n4)<-[r11]-(n5)<-[r12]-(n6)<-[r13]-(n7), (n8)-[r14 :T2]->(n9) WHERE (((((((((((((((((((((((((((((((((((((((((((((true AND (true AND true)) AND (((true AND true) AND (((true AND true) OR (true OR true)) OR true)) AND ((true AND (true OR true)) AND (true OR true)))) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND true) AND ((((((((true AND (true OR true)) AND (true AND true)) AND ((true OR true) AND (true OR true))) AND true) AND (true AND true)) AND (((((r12.k87) < -1816647876) OR true) AND (true OR true)) AND true)) AND (true AND true)) AND true)) RETURN n8.k21 as a1

Please notice the restrictions to the second last MATCH clause, that n8.k21 should be Rd4CeWku

MATCH (n8{k21:'Rd4CeWku'})-[r7]->(n9) WHERE true

However, the output contains an additional result that does not conform to this restrictions:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant