This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 3b5a9af3b Minor: restore explicit match (#5579)
3b5a9af3b is described below
commit 3b5a9af3b8944a3989e4264961b08173dde274d2
Author: Andrew Lamb <[email protected]>
AuthorDate: Tue Mar 14 14:20:38 2023 +0100
Minor: restore explicit match (#5579)
---
datafusion/expr/src/utils.rs | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/datafusion/expr/src/utils.rs b/datafusion/expr/src/utils.rs
index 95b5f881b..a0745025d 100644
--- a/datafusion/expr/src/utils.rs
+++ b/datafusion/expr/src/utils.rs
@@ -96,7 +96,44 @@ pub fn expr_to_columns(expr: &Expr, accum: &mut
HashSet<Column>) -> Result<()> {
Expr::ScalarVariable(_, var_names) => {
accum.insert(Column::from_name(var_names.join(".")));
}
- _ => {}
+ // Use explicit pattern match instead of a default
+ // implementation, so that in the future if someone adds
+ // new Expr types, they will check here as well
+ Expr::Alias(_, _)
+ | Expr::Literal(_)
+ | Expr::BinaryExpr { .. }
+ | Expr::Like { .. }
+ | Expr::ILike { .. }
+ | Expr::SimilarTo { .. }
+ | Expr::Not(_)
+ | Expr::IsNotNull(_)
+ | Expr::IsNull(_)
+ | Expr::IsTrue(_)
+ | Expr::IsFalse(_)
+ | Expr::IsUnknown(_)
+ | Expr::IsNotTrue(_)
+ | Expr::IsNotFalse(_)
+ | Expr::IsNotUnknown(_)
+ | Expr::Negative(_)
+ | Expr::Between { .. }
+ | Expr::Case { .. }
+ | Expr::Cast { .. }
+ | Expr::TryCast { .. }
+ | Expr::Sort { .. }
+ | Expr::ScalarFunction { .. }
+ | Expr::ScalarUDF { .. }
+ | Expr::WindowFunction { .. }
+ | Expr::AggregateFunction { .. }
+ | Expr::GroupingSet(_)
+ | Expr::AggregateUDF { .. }
+ | Expr::InList { .. }
+ | Expr::Exists { .. }
+ | Expr::InSubquery { .. }
+ | Expr::ScalarSubquery(_)
+ | Expr::Wildcard
+ | Expr::QualifiedWildcard { .. }
+ | Expr::GetIndexedField { .. }
+ | Expr::Placeholder { .. } => {}
}
Ok(())
})