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

fix: bind correlated subqueries #191

Merged
merged 1 commit into from
Mar 30, 2024
Merged

Conversation

crwen
Copy link
Member

@crwen crwen commented Mar 30, 2024

What problem does this PR solve?

Issue link: #192

there is something wrong when binding correlated subqueries because parent context is ignored.

explain select a,b from t where a in (select a from t1 where a > t.a);
ERROR:  invalid table: t

This PR is to resolve this problem

What is changed and how it works?

the main idea is to take parent binder into consideration, too. After changing, it looks like this:

                               PLAN
------------------------------------------------------------------
 Projection [t.a, t.b] [Project]                                 +
   LeftSemi Join On t.a = (t1.a) as (_temp_table_0_.a) [HashJoin]+
     Scan t -> [a, b] [SeqScan]                                  +
     Projection [(t1.a) as (_temp_table_0_.a)] [Project]         +
       Projection [t1.a] [Project]                               +
         Filter (t1.a > t.a), Is Having: false [Filter]          +
           Scan t1 -> [a] [SeqScan]

Code changes

  • Has Rust code change
  • Has CI related scripts change

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Note for reviewer

@crwen crwen mentioned this pull request Mar 30, 2024
4 tasks
@KKould KKould self-requested a review March 30, 2024 14:20
@KKould KKould added the bug Something isn't working label Mar 30, 2024
Copy link
Member

@KKould KKould left a comment

Choose a reason for hiding this comment

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

suddenly I remembered that I forgot to do this, when I added this parent before😂😂

@KKould KKould merged commit 8c18eef into KipData:main Mar 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants