OpenCypher: parameterized queries fail to match in property maps when there is an edge (original) (raw)

Description

OpenCypher parameterized queries do not substitute $param values when used in the right-hand side of MATCH node property maps ({id: $id}) if there is a relationship involved. This issue happens to me when running version 26.3.2 in Docker.

This issue seems similar to #3560 however it still happens in the latest version of ArcadeDB.

Reproduction

Using the REST API with curl after starting the Docker image without much setup.

Setup

curl -X POST -v http://localhost:2480/api/v1/command/benchtest --basic -u root:arcadedb-password -H "Content-Type: application/json" -d "{"language": "opencypher", "command": "CREATE (:A {f: 'a'})"}" curl -X POST -v http://localhost:2480/api/v1/command/benchtest --basic -u root:arcadedb-password -H "Content-Type: application/json" -d "{"language": "opencypher", "command": "CREATE (:B {f: 'x'})"}" curl -X POST -v http://localhost:2480/api/v1/command/benchtest --basic -u root:arcadedb-password -H "Content-Type: application/json" -d "{"language": "opencypher", "command": "MATCH (a:A {f: 'a'}) MATCH (b:B {f: 'x'}) CREATE (a)-[:LINK]->(b)"}"

Successful query 1

Passing the parameters literally works fine.

curl -X POST -v http://localhost:2480/api/v1/command/benchtest --basic -u root:arcadedb-password -H "Content-Type: application/json" -d "{"language": "opencypher", "command": "MATCH (a:A {f: 'a'})-[:LINK]->(b:B {f: 'x'}) RETURN a.f, b.f"}"

Returns the expected results correctly:

{"user":"root","result":[{"a.f":"a","b.f":"x"}]}

Successful query 2

Passing the left-hand side of the match with parameters works fine.

curl -X POST -v http://localhost:2480/api/v1/command/benchtest --basic -u root:arcadedb-password -H "Content-Type: application/json" -d "{"language": "opencypher", "command": "MATCH (a:A {f: $param})-[:LINK]->(b:B {f: 'x'}) RETURN a.f, b.f", "params": {"param": "a"}}"

Returns the expected results correctly:

{"user":"root","result":[{"a.f":"a","b.f":"x"}]}

Failed query

Passing the right-hand side of the match with parameters fails.

curl -X POST -v http://localhost:2480/api/v1/command/benchtest --basic -u root:arcadedb-password -H "Content-Type: application/json" -d "{"language": "opencypher", "command": "MATCH (a:A {f: 'a'})-[:LINK]->(b:B {f: $param}) RETURN a.f, b.f", "params": {"param": "x"}}"

Returns the expected results correctly:

{"user":"root","result":[]}

Environment

Impact

Queries that would have used parameters in the right-hand side will silently return no results, if they worked before.

Workaround

Use explicit WHERE clauses instead of inline property maps.