Skip to content

Commit f6db769

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 f2455fb commit f6db769

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

datafusion/expr/src/logical_plan/invariants.rs

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

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

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)?;

datafusion/physical-plan/src/joins/hash_join/exec.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,10 @@ impl HashJoinExec {
544544
check_join_is_valid(&left_schema, &right_schema, &on)?;
545545

546546
// Validate null_aware flag
547-
if null_aware {
548-
if !matches!(join_type, JoinType::LeftAnti) {
549-
return plan_err!(
550-
"null_aware can only be true for LeftAnti joins, got {join_type}"
551-
);
552-
}
547+
if null_aware && !matches!(join_type, JoinType::LeftAnti) {
548+
return plan_err!(
549+
"null_aware can only be true for LeftAnti joins, got {join_type}"
550+
);
553551
}
554552

555553
let (join_schema, column_indices) =

0 commit comments

Comments
 (0)