andygrove commented on code in PR #2885:
URL: https://github.com/apache/arrow-datafusion/pull/2885#discussion_r920228511


##########
datafusion/optimizer/src/decorrelate_where_in.rs:
##########
@@ -0,0 +1,333 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use crate::utils::{exprs_to_join_cols, find_join_exprs, split_conjunction};
+use crate::{utils, OptimizerConfig, OptimizerRule};
+use datafusion_common::Column;
+use datafusion_expr::logical_plan::{Filter, JoinType, Subquery};
+use datafusion_expr::{combine_filters, Expr, LogicalPlan, LogicalPlanBuilder};
+use log::debug;
+use std::sync::Arc;
+
+#[derive(Default)]
+pub struct DecorrelateWhereIn {}
+
+impl DecorrelateWhereIn {
+    #[allow(missing_docs)]
+    pub fn new() -> Self {
+        Self {}
+    }
+
+    /// Finds expressions that have a where in subquery
+    ///
+    /// # Arguments
+    ///
+    /// * `predicate` - A conjunction to split and search
+    ///
+    /// Returns a tuple of tuples ((expressions, subqueries, negated), 
remaining expressions)
+    fn extract_subquery_exprs(

Review Comment:
   Each of the new rules has some form of `extract_subquery_exprs`. Could we 
implement this method in the `LogicalPlan` instead to extract all subquery 
expressions and then have these rules filter on the specific ones they are 
interested in?
   
   I have implemented something basic in 
https://github.com/apache/arrow-datafusion/pull/2899 that does this.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to