Skip to content

Apache DataFusion SQL Query Engine

Minor: Clarify use of infallable APIs (#13217)

Andrew Lambba094e729241
diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs
index 025a48731d..0cdfa05521 100644
--- a/datafusion/expr/src/expr.rs
+++ b/datafusion/expr/src/expr.rs
@@ -1563,13 +1563,13 @@ impl Expr {
/// Returns true if there are any column references in this Expr
pub fn any_column_refs(&self) -> bool {
self.exists(|expr| Ok(matches!(expr, Expr::Column(_))))
- .unwrap()
+ .expect("exists closure is infallible")
}
- /// Return true when the expression contains out reference(correlated) expressions.
+ /// Return true if the expression contains out reference(correlated) expressions.
pub fn contains_outer(&self) -> bool {
self.exists(|expr| Ok(matches!(expr, Expr::OuterReferenceColumn { .. })))
- .unwrap()
+ .expect("exists closure is infallible")
}
/// Returns true if the expression node is volatile, i.e. whether it can return
@@ -1589,7 +1589,8 @@ impl Expr {
///
/// See [`Volatility`] for more information.
pub fn is_volatile(&self) -> bool {
- self.exists(|expr| Ok(expr.is_volatile_node())).unwrap()
+ self.exists(|expr| Ok(expr.is_volatile_node()))
+ .expect("exists closure is infallible")
}
/// Recursively find all [`Expr::Placeholder`] expressions, and