FalkorDB icon indicating copy to clipboard operation
FalkorDB copied to clipboard

`ANY` function does not return expected results

Open dracoooooo opened this issue 1 year ago • 2 comments

Description

Executing a Cypher query using the ANY function in FalkorDB fails to return the expected result.

Steps to Reproduce

CREATE (n:N {v:1});

WITH [0] AS c 
MATCH (n:N) 
WHERE ANY(v IN c WHERE n.v > v) 
RETURN 1;

Expected Result

1

Actual Result

Empty set.

dracoooooo avatar Dec 22 '24 19:12 dracoooooo

Hi @dracoooooo Thank you for reporting, this do sounds like a bug, we'll investigate.

swilly22 avatar Dec 22 '24 19:12 swilly22

Execution plan:

"WITH [0] AS c  MATCH (n:N)  WHERE ANY(v IN c WHERE n.v > v)  RETURN 1 as res"
1) "Results"
2) "    Project"
3) "        Node By Label Scan | (n:N)"
4) "            Filter"
5) "                Project"

Seems like the Filter operation is miss-placed, probably because we failed to understand the dependency on n which is referenced by the ANY condition.

The same issue exists with other predicates e.g. ALL

swilly22 avatar Dec 26 '24 11:12 swilly22