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

feat: Support Subquery on Where #136

Merged
merged 3 commits into from
Feb 11, 2024
Merged

feat: Support Subquery on Where #136

merged 3 commits into from
Feb 11, 2024

Conversation

KKould
Copy link
Member

@KKould KKould commented Feb 11, 2024

What problem does this PR solve?

SELECT A FROM TABLE_E061_09_01_02 WHERE A < (SELECT 2) and (-A + 2) < ( SELECT 1 ) + 1

+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| PLAN                                                                                                                                                    |
+=========================================================================================================================================================+
| Projection [table_e061_09_01_02.a] [Project]                                                                                                            |
|   Inner Join Where ((table_e061_09_01_02.a < (2) as (_temp_table_1_.2)) && ((-table_e061_09_01_02.a + 2) < ((1) as (_temp_table_2_.1) + 1))) [HashJoin] |
|     Inner Join Where (table_e061_09_01_02.a < (2) as (_temp_table_1_.2)) [HashJoin]                                                                     |
|       Scan table_e061_09_01_02 -> [a] [SeqScan]                                                                                                         |
|       Projection [2] [Project]                                                                                                                          |
|         Dummy [Dummy]                                                                                                                                   |
|     Projection [1] [Project]                                                                                                                            |
|       Dummy [Dummy]                                                                                                                                     |
+---------------------------------------------------------------------------------------------------------------------------------------------------------+

Choose whether to use InnerJoin or Filter by judging whether there is Subquery in Where.

Tips: The predicate in Join On will be judged for filtering, and when two Dummy subqueries return consistent constants, the mapping does not appear to conform to the normal situation, that is, the predicates are repeated, but because the constants are the same, the calculation process is still correct.

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

@KKould KKould added the enhancement New feature or request label Feb 11, 2024
@KKould KKould self-assigned this Feb 11, 2024
@KKould KKould mentioned this pull request Feb 11, 2024
51 tasks
@KKould KKould merged commit 86aaf60 into KipData:main Feb 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant