irenjj opened a new issue, #16173:
URL: https://github.com/apache/datafusion/issues/16173

   ### Is your feature request related to a problem or challenge?
   
   As the first step implementation of the HyPer paper 'Unnesting Arbitrary 
Queries', it will converts correlated subqueries into the form of dependent 
joins.
   In DuckDB:
   ```sql
   ┌─────────────────────────────┐
   │┌───────────────────────────┐│
   ││ Unoptimized Logical Plan  ││
   │└───────────────────────────┘│
   └─────────────────────────────┘
   ┌───────────────────────────┐
   │         PROJECTION        │
   │    ────────────────────   │
   │        Expressions:       │
   │             id            │
   │           value           │
   └─────────────┬─────────────┘
   ┌─────────────┴─────────────┐
   │           FILTER          │
   │    ────────────────────   │
   │        Expressions:       │
   │  (CAST(value AS BIGINT) > │
   │          SUBQUERY)        │
   └─────────────┬─────────────┘
   ┌─────────────┴─────────────┐
   │       DEPENDENT_JOIN      │
   │    ────────────────────   ├──────────────┐
   │     Join Type: SINGLE     │              │
   └─────────────┬─────────────┘              │
   ┌─────────────┴─────────────┐┌─────────────┴─────────────┐
   │          SEQ_SCAN         ││         PROJECTION        │
   │    ────────────────────   ││    ────────────────────   │
   │       Table: table1       ││        Expressions:       │
   │   Type: Sequential Scan   ││        count_star()       │
   └───────────────────────────┘└─────────────┬─────────────┘
                                ┌─────────────┴─────────────┐
                                │         AGGREGATE         │
                                │    ────────────────────   │
                                │        Expressions:       │
                                │        count_star()       │
                                └─────────────┬─────────────┘
                                ┌─────────────┴─────────────┐
                                │           FILTER          │
                                │    ────────────────────   │
                                │        Expressions:       │
                                │       (ref_id = id)       │
                                │ (CAST(quantity AS BIGINT) │
                                │        = SUBQUERY)        │
                                └─────────────┬─────────────┘
                                ┌─────────────┴─────────────┐
                                │       DEPENDENT_JOIN      │
                                │    ────────────────────   ├──────────────┐
                                │     Join Type: SINGLE     │              │
                                └─────────────┬─────────────┘              │
                                
┌─────────────┴─────────────┐┌─────────────┴─────────────┐
                                │          SEQ_SCAN         ││         
PROJECTION        │
                                │    ────────────────────   ││    
────────────────────   │
                                │       Table: table2       ││        
Expressions:       │
                                │   Type: Sequential Scan   ││        
count_star()       │
                                
└───────────────────────────┘└─────────────┬─────────────┘
                                                             
┌─────────────┴─────────────┐
                                                             │         
AGGREGATE         │
                                                             │    
────────────────────   │
                                                             │        
Expressions:       │
                                                             │        
count_star()       │
                                                             
└─────────────┬─────────────┘
                                                             
┌─────────────┴─────────────┐
                                                             │           FILTER 
         │
                                                             │    
────────────────────   │
                                                             │        
Expressions:       │
                                                             │         (id = 
id)         │
                                                             
└─────────────┬─────────────┘
                                                             
┌─────────────┴─────────────┐
                                                             │          
SEQ_SCAN         │
                                                             │    
────────────────────   │
                                                             │       Table: 
table1       │
                                                             │   Type: 
Sequential Scan   │
                                                             
└───────────────────────────┘
   
   ```
   
   ### Describe the solution you'd like
   
   I'd like to split into follow small tasks:
   - [ ] Transform scalar correlated subqueries in `Where` to DependentJoin: 
#16172
   - [ ] Transform scalar correlated subqueries in `Select` to DependentJoin: 
   - [ ] Other subquery type support:
   ...
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to