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

Match query followd by a with clause report alias redefined semantic error (2) #5020

Closed
nebula-bots opened this issue Dec 7, 2022 · 0 comments · Fixed by #5021
Closed

Match query followd by a with clause report alias redefined semantic error (2) #5020

nebula-bots opened this issue Dec 7, 2022 · 0 comments · Fixed by #5021
Assignees
Labels
affects/master PR/issue: this bug affects master version. auto-sync find/automation process/done Process of bug severity/major Severity of bug type/bug Type: something is unexpected
Milestone

Comments

@nebula-bots
Copy link
Contributor

Please check the FAQ documentation before raising an issue

Describe the bug (required)

A similar problem to #1579 but with a different query and even though we have applied the fix of #1579 (tested on latest community master branch), the query below still report a Redefined alias error:

(root@nebula) [gdlancer]> MATCH (v0:Label_0)<-[e0]-(v1)-[e1]->(v2) WHERE (id(v0) in [23, 5, 3, 13, 12, 29, 27, 30, 16, 2, 28]) AND (e0.Rel_5_0_Bool) MATCH (v1)<-[e2:Rel_3]-()-[e3:Rel_5]->(v3) WHERE (e3.Rel_5_0_Bool) WITH v1, min(e1.Rel_2_0_Int) AS pa0, e2.Rel_3_2_Double AS pa1, e3.Rel_0_3_Int AS pa2, v1.Label_2.Label_2_1_Int AS pa3, v2, v3 WHERE (((pa0 - ((- (- pa1)) - (- 0.297574))) / (((- (v1.Label_2.Label_2_1_Int + v1.Label_2.Label_2_4_Int)) + (- 24)) % (v1.Label_2.Label_2_2_Double - 91))) > v1.Label_2.Label_2_1_Int) MATCH (v4:Label_5:Label_2)-[e4:Rel_1]->(:Label_2:Label_3)<-[e5]-() WHERE (id(v4) in [11, 3, 27, 12, 21, 16, 31, 19, 8, 17, 9]) AND (e5.Rel_2_4_Bool) MATCH (v5)-[e6:Rel_3]->(v6)<-[e7:Rel_2]-(v3) WHERE (id(v5) == 19) AND (e5.Rel_2_4_Bool) MATCH p0 = (v7:Label_3{Label_3_4_String: 'Stephen Curry'})<-[e8]-(v2)-[e9:Rel_3]->(v8:Label_4{Label_4_3_Double: 0.175132}) WHERE (id(v7) in [14, 3, 19, 21, 15, 9, 2, 12, 7, 27, 23]) AND ((v8.Label_0.Label_0_4_Int <= (- v1.Label_2.Label_2_2_Double))) WITH * return count(*)
[ERROR (-1009)]: SemanticError: `v3': Redefined alias

Mon, 28 Nov 2022 11:41:13 CST

(root@nebula) [gdlancer]>

In contrast the same query on Neo4j report no error:

$ MATCH (v0:Label_0)<-[e0]-(v1)-[e1]->(v2) WHERE (v0.id in [23, 5, 3, 13, 12, 29, 27, 30, 16, 2, 28]) AND (e0.Rel_5_0_Bool) MATCH (v1)<-[e2:Rel_3]-()-[e3:Rel_5]->(v3) WHERE (e3.Rel_5_0_Bool) WITH v1, min(e1.Rel_2_0_Int) AS pa0, e2.Rel_3_2_Double AS pa1, e3.Rel_0_3_Int AS pa2, v1.Label_2_1_Int AS pa3, v2, v3 WHERE (((pa0 - ((- (- pa1)) - (- 0.297574))) / (((- (v1.Label_2_1_Int + v1.Label_2_4_Int)) + (- 24)) % (v1.Label_2_2_Double - 91))) > v1.Label_2_1_Int) MATCH (v4:Label_5:Label_2)-[e4:Rel_1]->(:Label_2:Label_3)<-[e5]-() WHERE (v4.id in [11, 3, 27, 12, 21, 16, 31, 19, 8, 17, 9]) AND (e5.Rel_2_4_Bool) MATCH (v5)-[e6:Rel_3]->(v6)<-[e7:Rel_2]-(v3) WHERE (v5.id = 19) AND (e5.Rel_2_4_Bool) MATCH p0 = (v7:Label_3{Label_3_4_String: 'Stephen Curry'})<-[e8]-(v2)-[e9:Rel_3]->(v8:Label_4{Label_4_3_Double: 0.175132}) WHERE (v7.id in [14, 3, 19, 21, 15, 9, 2, 12, 7, 27, 23]) AND ((v8.Label_0_4_Int <= (- v1.Label_2_2_Double))) WITH * return count(*)

╒══════════╕
│"count(*)"│
╞══════════╡
│0         │
└──────────┘

Your Environments (required)

How To Reproduce(required)

Steps to reproduce the behavior:

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

Expected behavior

Additional context

@nebula-bots nebula-bots added affects/master PR/issue: this bug affects master version. auto-sync find/automation severity/major Severity of bug type/bug Type: something is unexpected labels Dec 7, 2022
@Sophie-Xie Sophie-Xie added this to the v3.4.0 milestone Dec 8, 2022
@github-actions github-actions bot added the process/fixed Process of bug label Dec 8, 2022
@Hester-Gu Hester-Gu added the process/done Process of bug label Jan 13, 2023
@github-actions github-actions bot removed the process/fixed Process of bug label Jan 13, 2023
yixinglu pushed a commit to yixinglu/nebula that referenced this issue Jan 31, 2023
<!--
Thanks for your contribution!
In order to review PR more efficiently, please add information according to the template.
-->

## What type of PR is this?
- [X] bug
- [ ] feature
- [ ] enhancement

## What problem(s) does this PR solve?
#### Issue(s) number: 
Close vesoft-inc#5020 

#### Description:
The `with *` in a match clause like `match ...(v999)... match ... match ... match ...(v999)... with *` from a multi-match query, where v999 is defined in a previous match, rebuilds named aliases from all query parts, causing v999 to duplicate and trigger a false error.

This is actually ok, since they are in fact the same ones. There is actually no redefinition. This compiles with openCypher and neo4j.

## How do you solve it?

1. Allow the usage of aliases defined in previous matches. Only report redefinition of aliases if an alias is repeateed within the current query part.
2. Fixed an unstable tck case.


## Special notes for your reviewer, ex. impact of this fix, design document, etc:



## Checklist:
Tests:
- [ ] Unit test(positive and negative cases)
- [ ] Function test
- [ ] Performance test
- [X] TCK

Affects:
- [ ] Documentation affected (Please add the label if documentation needs to be modified.)
- [ ] Incompatibility (If it breaks the compatibility, please describe it and add the label.)
- [ ] If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
- [ ] Performance impacted: Consumes more CPU/Memory


## Release notes:

Please confirm whether to be reflected in release notes and how to describe:
> ex. Fixed the bug .....


Migrated from vesoft-inc#5021

Co-authored-by: Cheng Xuntao <7731943+xtcyclist@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/master PR/issue: this bug affects master version. auto-sync find/automation process/done Process of bug severity/major Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants