Skip to content

Commit 55bca07

Browse files
committed
fix: Address clippy warnings
- Collapse nested if statement in invariants.rs (clippy::collapsible_if) - Collapse nested if statement in hash_join/exec.rs (clippy::collapsible_if) - Use unwrap_or_else instead of unwrap_or for function calls in decorrelate_predicate_subquery.rs (clippy::or_fun_call)
1 parent b9ab91a commit 55bca07

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

datafusion/expr/src/logical_plan/invariants.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,14 @@ pub fn check_subquery_expr(
239239
}
240240

241241
// For struct expressions, validate that the number of fields matches
242-
if is_struct {
243-
if let Expr::ScalarFunction(ref func) = *subquery.expr {
244-
let num_tuple_cols = func.args.len();
245-
if num_tuple_cols != num_subquery_cols {
246-
return plan_err!(
247-
"The number of columns in the tuple ({}) must match the number of columns in the subquery ({})",
248-
num_tuple_cols,
249-
num_subquery_cols
250-
);
251-
}
242+
if is_struct && let Expr::ScalarFunction(ref func) = *subquery.expr {
243+
let num_tuple_cols = func.args.len();
244+
if num_tuple_cols != num_subquery_cols {
245+
return plan_err!(
246+
"The number of columns in the tuple ({}) must match the number of columns in the subquery ({})",
247+
num_tuple_cols,
248+
num_subquery_cols
249+
);
252250
}
253251
}
254252
}

datafusion/optimizer/src/decorrelate_predicate_subquery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ fn build_join(
420420
let in_predicate = conditions
421421
.into_iter()
422422
.reduce(|acc, cond| acc.and(cond))
423-
.unwrap_or(lit(true));
423+
.unwrap_or_else(|| lit(true));
424424

425425
in_predicate.and(join_filter)
426426
} else {
@@ -481,7 +481,7 @@ fn build_join(
481481
conditions
482482
.into_iter()
483483
.reduce(|acc, cond| acc.and(cond))
484-
.unwrap_or(lit(true))
484+
.unwrap_or_else(|| lit(true))
485485
} else {
486486
// Regular scalar function, handle as before
487487
let right_col = create_col_from_scalar_expr(right.deref(), alias)?;

0 commit comments

Comments
 (0)