Skip to content

Fix the scope analysis of the CTEs #729

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

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

goldmedal
Copy link
Contributor

Describe

We didn't build the correct scope for the CTE. This leads to some analysis errors when making the decision point analysis.

Comment on lines +723 to +725
WITH t1 as (SELECT customer.custkey FROM customer),
t2 as (SELECT (t1.custkey + 1) as custkey_plus FROM t1)
SELECT custkey_plus FROM t2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only analyze the top-level expression. We won't dig into the child of this expression. So, the number of expression sources of custkey_plus is zero.

@cyyeh
Copy link
Member

cyyeh commented Aug 6, 2024

@goldmedal thanks for your help! the issue seems fixed after some manual testing

Copy link
Contributor

@grieve54706 grieve54706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @goldmedal.

@grieve54706 grieve54706 merged commit 3a04ba7 into main Aug 6, 2024
8 of 9 checks passed
@grieve54706 grieve54706 deleted the bugfix/fix-deep-scope-analysis branch August 6, 2024 02:58
grieve54706 pushed a commit that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants