irenjj commented on code in PR #16016:
URL: https://github.com/apache/datafusion/pull/16016#discussion_r2112941516


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -287,6 +287,105 @@ pub enum LogicalPlan {
     Unnest(Unnest),
     /// A variadic query (e.g. "Recursive CTEs")
     RecursiveQuery(RecursiveQuery),
+    /// A node type that only exist during subquery decorrelation
+    /// TODO: maybe we can avoid creating new type of LogicalPlan for this 
usecase
+    DependentJoin(DependentJoin),
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct DependentJoin {
+    pub schema: DFSchemaRef,
+    // All combinatoins of (subquery,OuterReferencedExpr) on the RHS (and its 
descendant)
+    // which points to a column on the LHS.
+    // The Expr should always be Expr::OuterRefColumn.
+    // Note that not all outer_refs from the RHS are mentioned in this vectors
+    // because RHS may reference columns provided somewhere from the above 
join.
+    // Depths of each correlated_columns should always be gte current 
dependent join
+    // subquery_depth
+    pub correlated_columns: Vec<(usize, Expr)>,

Review Comment:
   Since the decorrelation phase involves column matching, this structure might 
be better as it could reduce the use of `if let Expr::Column(col) =`:
   ```rust
   struct CorrelatedColumnInfo
   {
       depth: usize,
       type: DataType,
       column: Column,
       ...
   }
   ```



-- 
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

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