nathanb9 commented on code in PR #22736:
URL: https://github.com/apache/datafusion/pull/22736#discussion_r3356010325


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -4387,8 +4407,49 @@ impl Subquery {
             subquery: plan,
             outer_ref_columns: self.outer_ref_columns.clone(),
             spans: Spans::new(),
+            scalar_subquery_index: self.scalar_subquery_index,
+        }
+    }
+
+    pub fn with_scalar_subquery_index(&self, index: SubqueryIndex) -> Subquery 
{
+        Subquery {
+            subquery: Arc::clone(&self.subquery),
+            outer_ref_columns: self.outer_ref_columns.clone(),
+            spans: self.spans.clone(),
+            scalar_subquery_index: Some(index),
+        }
+    }
+
+    pub fn without_scalar_subquery_index(&self) -> Subquery {
+        Subquery {
+            subquery: Arc::clone(&self.subquery),
+            outer_ref_columns: self.outer_ref_columns.clone(),
+            spans: self.spans.clone(),
+            scalar_subquery_index: None,
         }
     }
+
+    /// Returns `true` if this subquery's plan contains a volatile expression.
+    pub fn is_volatile(&self) -> bool {
+        plan_contains_volatile(&self.subquery)
+    }
+}
+
+/// Returns `true` if any expression in `plan` is volatile.
+fn plan_contains_volatile(plan: &LogicalPlan) -> bool {

Review Comment:
   small but is it possible to make this public?
   Would be useful for detecting volatile functions when materializing subplans 
(https://github.com/apache/datafusion/issues/22676)



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to