This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new 4f48815 Add some additional asserts in `utils::from_plan` (#930)
4f48815 is described below
commit 4f48815bdb6655fd3eb6366163742edea52ddf10
Author: Andrew Lamb <[email protected]>
AuthorDate: Wed Aug 25 06:28:06 2021 -0400
Add some additional asserts in `utils::from_plan` (#930)
---
datafusion/src/optimizer/utils.rs | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/datafusion/src/optimizer/utils.rs
b/datafusion/src/optimizer/utils.rs
index 07e758d..2f1a081 100644
--- a/datafusion/src/optimizer/utils.rs
+++ b/datafusion/src/optimizer/utils.rs
@@ -206,10 +206,28 @@ pub fn from_plan(
input: Arc::new(inputs[0].clone()),
})
}
+ LogicalPlan::Explain { .. } => {
+ // Explain shoudl be handled specially in the optimizers;
+ // If this assert fails it means some optimizer pass is
+ // trying to optimize Explain directly
+ assert!(
+ expr.is_empty(),
+ "Explain can not be created from utils::from_expr"
+ );
+ assert!(
+ inputs.is_empty(),
+ "Explain can not be created from utils::from_expr"
+ );
+ Ok(plan.clone())
+ }
LogicalPlan::EmptyRelation { .. }
| LogicalPlan::TableScan { .. }
- | LogicalPlan::CreateExternalTable { .. }
- | LogicalPlan::Explain { .. } => Ok(plan.clone()),
+ | LogicalPlan::CreateExternalTable { .. } => {
+ // All of these plan types have no inputs / exprs so should not be
called
+ assert!(expr.is_empty(), "{:?} should have no exprs", plan);
+ assert!(inputs.is_empty(), "{:?} should have no inputs", plan);
+ Ok(plan.clone())
+ }
}
}