timsaucer commented on code in PR #22559:
URL: https://github.com/apache/datafusion/pull/22559#discussion_r3310945973
##########
datafusion/physical-plan/src/execution_plan.rs:
##########
@@ -718,20 +813,44 @@ pub trait ExecutionPlan: Any + Debug + DisplayAs + Send +
Sync {
impl dyn ExecutionPlan {
/// Returns `true` if the plan is of type `T`.
///
+ /// If this plan is a transparent wrapper, also checks its
+ /// [`ExecutionPlan::transparent_child`].
+ ///
/// Prefer this over `downcast_ref::<T>().is_some()`. Works correctly when
/// called on `Arc<dyn ExecutionPlan>` via auto-deref.
pub fn is<T: ExecutionPlan>(&self) -> bool {
- (self as &dyn Any).is::<T>()
+ if (self as &dyn Any).is::<T>() {
+ return true;
+ }
+
+ let Some(child) = self.transparent_child() else {
+ return false;
+ };
+ if std::ptr::eq(self, child) {
+ return false;
+ }
Review Comment:
Oh, this was from the prior commit
--
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]