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

Rethink variable scope validation for path pattern #5221

Open
yixinglu opened this issue Jan 9, 2023 · 5 comments
Open

Rethink variable scope validation for path pattern #5221

yixinglu opened this issue Jan 9, 2023 · 5 comments
Assignees
Labels
affects/none PR/issue: this bug affects none version. later Solution: this issue will be handle in later version severity/none Severity of bug type/bug Type: something is unexpected

Comments

@yixinglu
Copy link
Contributor

yixinglu commented Jan 9, 2023

Please check the FAQ documentation before raising an issue

Describe the bug (required)

At present, the variable validation in path pattern only happens in match clause, but when the path pattern placed in the expression context, the variable's behavior will not be expected.

for example:

MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)
WHERE size([i in e WHERE (v)-[i]-(v2) | i])>1
RETURN count(*) AS cnt

//------

MATCH (v:player{name: 'Tim Duncan'})-[e:like*0..2]-(v2)-[i]-(v3)
WHERE size([i in e WHERE (v)-[i]-(v2) | i])>1
RETURN count(*) AS cnt

above tests are from the PR #5215 , and report the following error:

[ERROR (-1004)]: SyntaxError: syntax is ambiguous near `(v)-[i]-(v2)'

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

Steps to reproduce the behavior:

  1. Step 1
  2. Step 2
  3. Step 3

Expected behavior

Additional context

@yixinglu yixinglu added the type/bug Type: something is unexpected label Jan 9, 2023
@github-actions github-actions bot added affects/none PR/issue: this bug affects none version. severity/none Severity of bug labels Jan 9, 2023
@yixinglu
Copy link
Contributor Author

yixinglu commented Jan 9, 2023

@czpmango could you add more tests discussed offline for this topic?

@czpmango
Copy link
Contributor

czpmango commented Jan 9, 2023

Variable shadowing error is unexpected:

(root@nebula) [nba]> match (v:player)-[e*2]->(n) where size([n in e where (v{name:"Tim Duncan"})-[n]-()])>3 return v
[ERROR (-1009)]: SemanticError: `n' is defined with type Node, but referenced with type Edge

Making an implicit join on the inner variable n and the outer variable n by mistake leads to an incorrect result. The expected row number is 4945(test in neo4j 4.2.1).

(root@nebula) [nba]>  match (v:player)-[e*2]->()-[n]-() where size([n in e where (v)-[n]-()])>0 return count(*)
+----------+
| count(*) |
+----------+
| 837      |
+----------+
Got 1 rows (time spent 132190/132459 us)

@xtcyclist
Copy link
Contributor

xtcyclist commented Jan 11, 2023

Moved this issue to the 3.5 milestone. path pattern placed in the expression context does not seem to be an urgent issue for 3.4. 3.4 is mainly for stability.

@xtcyclist xtcyclist modified the milestones: v3.4.0, v3.5.0 Jan 11, 2023
@yixinglu
Copy link
Contributor Author

related to #5235

@Sophie-Xie Sophie-Xie added need to discuss Solution: issue or PR without a clear conclusion on whether to handle it later Solution: this issue will be handle in later version and removed need to discuss Solution: issue or PR without a clear conclusion on whether to handle it labels Mar 6, 2023
@Sophie-Xie Sophie-Xie assigned MuYiYong and unassigned yixinglu Mar 10, 2023
@dutor
Copy link
Contributor

dutor commented Mar 30, 2023

Moved this issue to the 3.5 milestone. path pattern placed in the expression context does not seem to be an urgent issue for 3.4. 3.4 is mainly for stability.

Considering the amount of work, better to fix it in later version after v3.5.

@Sophie-Xie Sophie-Xie removed this from the v3.5.0 milestone Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/none PR/issue: this bug affects none version. later Solution: this issue will be handle in later version severity/none Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

6 participants