Skip to content

Feat: Support correlated subqueries #192

@crwen

Description

@crwen

Feature Request

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

After fix this bug, we may have the plan 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]

Filter (t1.a > t.a) can't be handle correctly because it doesn't have the data of t. So we need to pull up this filter.

Maybe we could pull up all filters, and then push them down. so the things we should do next is here:

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions