This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new db5197b742 chore: Replace `matches!` on fieldless enums with `==` 
(#20525)
db5197b742 is described below

commit db5197b742856843f716d2fab396818c8d7b341f
Author: Neil Conway <[email protected]>
AuthorDate: Tue Feb 24 10:48:06 2026 -0500

    chore: Replace `matches!` on fieldless enums with `==` (#20525)
    
    ## Which issue does this PR close?
    
    N/A
    
    ## Rationale for this change
    
    When comparing a value with a field-less enum that implements
    `PartialEq`, `==` is simpler and more readable than `matches!`.
    
    ## What changes are included in this PR?
    
    ## Are these changes tested?
    
    Yes.
    
    ## Are there any user-facing changes?
    
    No.
---
 datafusion/common/src/stats.rs                           |  2 +-
 datafusion/common/src/types/native.rs                    |  4 ++--
 datafusion/core/src/physical_planner.rs                  | 12 +++++-------
 datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs       |  2 +-
 datafusion/core/tests/fuzz_cases/window_fuzz.rs          |  2 +-
 datafusion/expr-common/src/signature.rs                  |  2 +-
 datafusion/expr-common/src/type_coercion/binary.rs       |  2 +-
 datafusion/expr/src/logical_plan/plan.rs                 |  2 +-
 datafusion/functions-aggregate/src/regr.rs               |  2 +-
 datafusion/functions-window/src/nth_value.rs             |  2 +-
 datafusion/functions/src/core/getfield.rs                |  2 +-
 .../optimizer/src/decorrelate_predicate_subquery.rs      |  2 +-
 datafusion/optimizer/src/push_down_filter.rs             |  2 +-
 datafusion/physical-expr/src/expressions/case.rs         |  2 +-
 datafusion/physical-expr/src/partitioning.rs             |  2 +-
 .../physical-optimizer/src/combine_partial_final_agg.rs  |  2 +-
 .../physical-optimizer/src/enforce_distribution.rs       |  6 +++---
 datafusion/physical-plan/src/aggregates/mod.rs           |  6 +++---
 datafusion/physical-plan/src/filter.rs                   |  4 ++--
 datafusion/physical-plan/src/joins/hash_join/exec.rs     |  8 ++++----
 .../src/joins/piecewise_merge_join/classic_join.rs       |  2 +-
 .../physical-plan/src/joins/sort_merge_join/exec.rs      |  4 ++--
 .../physical-plan/src/joins/sort_merge_join/stream.rs    | 16 ++++++++--------
 .../physical-plan/src/joins/sort_merge_join/tests.rs     |  4 ++--
 datafusion/physical-plan/src/joins/utils.rs              |  2 +-
 datafusion/physical-plan/src/sorts/sort.rs               |  2 +-
 datafusion/physical-plan/src/union.rs                    |  2 +-
 datafusion/pruning/src/pruning_predicate.rs              |  2 +-
 datafusion/spark/src/function/map/map_from_arrays.rs     |  4 +---
 datafusion/spark/src/function/math/width_bucket.rs       |  4 ++--
 datafusion/spark/src/function/string/format_string.rs    |  2 +-
 datafusion/sql/src/expr/function.rs                      |  2 +-
 datafusion/sql/src/planner.rs                            |  8 ++++----
 .../substrait/src/logical_plan/producer/expr/cast.rs     |  2 +-
 34 files changed, 60 insertions(+), 64 deletions(-)

diff --git a/datafusion/common/src/stats.rs b/datafusion/common/src/stats.rs
index cecf1d0341..3d4d9b6c6c 100644
--- a/datafusion/common/src/stats.rs
+++ b/datafusion/common/src/stats.rs
@@ -1265,7 +1265,7 @@ mod tests {
             col_stats.min_value,
             Precision::Inexact(ScalarValue::Int32(Some(-10)))
         );
-        assert!(matches!(col_stats.sum_value, Precision::Absent));
+        assert_eq!(col_stats.sum_value, Precision::Absent);
     }
 
     #[test]
diff --git a/datafusion/common/src/types/native.rs 
b/datafusion/common/src/types/native.rs
index 5ef90b7209..65b6a5a15f 100644
--- a/datafusion/common/src/types/native.rs
+++ b/datafusion/common/src/types/native.rs
@@ -499,7 +499,7 @@ impl NativeType {
 
     #[inline]
     pub fn is_date(&self) -> bool {
-        matches!(self, NativeType::Date)
+        *self == NativeType::Date
     }
 
     #[inline]
@@ -524,7 +524,7 @@ impl NativeType {
 
     #[inline]
     pub fn is_null(&self) -> bool {
-        matches!(self, NativeType::Null)
+        *self == NativeType::Null
     }
 
     #[inline]
diff --git a/datafusion/core/src/physical_planner.rs 
b/datafusion/core/src/physical_planner.rs
index 6765b7f79f..4d169a58ef 100644
--- a/datafusion/core/src/physical_planner.rs
+++ b/datafusion/core/src/physical_planner.rs
@@ -1395,7 +1395,7 @@ impl DefaultPhysicalPlanner {
 
                 // TODO: Allow PWMJ to deal with residual equijoin conditions
                 let join: Arc<dyn ExecutionPlan> = if join_on.is_empty() {
-                    if join_filter.is_none() && matches!(join_type, 
JoinType::Inner) {
+                    if join_filter.is_none() && *join_type == JoinType::Inner {
                         // cross join if there is no join conditions and no 
join filter set
                         Arc::new(CrossJoinExec::new(physical_left, 
physical_right))
                     } else if num_range_filters == 1
@@ -1470,9 +1470,7 @@ impl DefaultPhysicalPlanner {
 
                         let left_side = side_of(lhs_logical)?;
                         let right_side = side_of(rhs_logical)?;
-                        if matches!(left_side, Side::Both)
-                            || matches!(right_side, Side::Both)
-                        {
+                        if left_side == Side::Both || right_side == Side::Both 
{
                             return Ok(Arc::new(NestedLoopJoinExec::try_new(
                                 physical_left,
                                 physical_right,
@@ -3553,12 +3551,12 @@ mod tests {
             assert!(
                 stringified_plans
                     .iter()
-                    .any(|p| matches!(p.plan_type, PlanType::FinalLogicalPlan))
+                    .any(|p| p.plan_type == PlanType::FinalLogicalPlan)
             );
             assert!(
                 stringified_plans
                     .iter()
-                    .any(|p| matches!(p.plan_type, 
PlanType::InitialPhysicalPlan))
+                    .any(|p| p.plan_type == PlanType::InitialPhysicalPlan)
             );
             assert!(
                 stringified_plans.iter().any(|p| matches!(
@@ -3569,7 +3567,7 @@ mod tests {
             assert!(
                 stringified_plans
                     .iter()
-                    .any(|p| matches!(p.plan_type, 
PlanType::FinalPhysicalPlan))
+                    .any(|p| p.plan_type == PlanType::FinalPhysicalPlan)
             );
         } else {
             panic!(
diff --git a/datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs 
b/datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs
index 97d1db5728..d64223abdb 100644
--- a/datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/aggregate_fuzz.rs
@@ -554,7 +554,7 @@ async fn verify_ordered_aggregate(frame: &DataFrame, 
expected_sort: bool) {
                         InputOrderMode::PartiallySorted(_) | 
InputOrderMode::Sorted
                     ));
                 } else {
-                    assert!(matches!(exec.input_order_mode(), 
InputOrderMode::Linear));
+                    assert_eq!(*exec.input_order_mode(), 
InputOrderMode::Linear);
                 }
             }
             Ok(TreeNodeRecursion::Continue)
diff --git a/datafusion/core/tests/fuzz_cases/window_fuzz.rs 
b/datafusion/core/tests/fuzz_cases/window_fuzz.rs
index 1212c081eb..82b6d0e4e9 100644
--- a/datafusion/core/tests/fuzz_cases/window_fuzz.rs
+++ b/datafusion/core/tests/fuzz_cases/window_fuzz.rs
@@ -589,7 +589,7 @@ async fn run_window_test(
     orderby_columns: Vec<&str>,
     search_mode: InputOrderMode,
 ) -> Result<()> {
-    let is_linear = !matches!(search_mode, Sorted);
+    let is_linear = search_mode != Sorted;
     let mut rng = StdRng::seed_from_u64(random_seed);
     let schema = input1[0].schema();
     let session_config = SessionConfig::new().with_batch_size(50);
diff --git a/datafusion/expr-common/src/signature.rs 
b/datafusion/expr-common/src/signature.rs
index 4c766b2cc5..857e9dc5d4 100644
--- a/datafusion/expr-common/src/signature.rs
+++ b/datafusion/expr-common/src/signature.rs
@@ -1416,7 +1416,7 @@ impl Signature {
             Arity::Variable => {
                 // For UserDefined signatures, allow parameter names
                 // The function implementer is responsible for validating the 
names match the actual arguments
-                if !matches!(self.type_signature, TypeSignature::UserDefined) {
+                if self.type_signature != TypeSignature::UserDefined {
                     return plan_err!(
                         "Cannot specify parameter names for variable arity 
signature: {:?}",
                         self.type_signature
diff --git a/datafusion/expr-common/src/type_coercion/binary.rs 
b/datafusion/expr-common/src/type_coercion/binary.rs
index 4daa8a7a7f..c6ac86cd39 100644
--- a/datafusion/expr-common/src/type_coercion/binary.rs
+++ b/datafusion/expr-common/src/type_coercion/binary.rs
@@ -526,7 +526,7 @@ impl From<&DataType> for TypeCategory {
                     return TypeCategory::Numeric;
                 }
 
-                if matches!(data_type, DataType::Boolean) {
+                if *data_type == DataType::Boolean {
                     return TypeCategory::Boolean;
                 }
 
diff --git a/datafusion/expr/src/logical_plan/plan.rs 
b/datafusion/expr/src/logical_plan/plan.rs
index 032a97bdb3..1c901f6d4a 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -1965,7 +1965,7 @@ impl LogicalPlan {
                             .unwrap_or_else(|| "".to_string());
                         let join_type = if filter.is_none()
                             && keys.is_empty()
-                            && matches!(join_type, JoinType::Inner)
+                            && *join_type == JoinType::Inner
                         {
                             "Cross".to_string()
                         } else {
diff --git a/datafusion/functions-aggregate/src/regr.rs 
b/datafusion/functions-aggregate/src/regr.rs
index 066fa3c5f3..7fef8ac981 100644
--- a/datafusion/functions-aggregate/src/regr.rs
+++ b/datafusion/functions-aggregate/src/regr.rs
@@ -455,7 +455,7 @@ impl AggregateUDFImpl for Regr {
     }
 
     fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
-        if matches!(self.regr_type, RegrType::Count) {
+        if self.regr_type == RegrType::Count {
             Ok(DataType::UInt64)
         } else {
             Ok(DataType::Float64)
diff --git a/datafusion/functions-window/src/nth_value.rs 
b/datafusion/functions-window/src/nth_value.rs
index c8980d9f1d..8d37cf7e60 100644
--- a/datafusion/functions-window/src/nth_value.rs
+++ b/datafusion/functions-window/src/nth_value.rs
@@ -269,7 +269,7 @@ impl WindowUDFImpl for NthValue {
             kind: self.kind,
         };
 
-        if !matches!(self.kind, NthValueKind::Nth) {
+        if self.kind != NthValueKind::Nth {
             return Ok(Box::new(NthValueEvaluator {
                 state,
                 ignore_nulls: partition_evaluator_args.ignore_nulls(),
diff --git a/datafusion/functions/src/core/getfield.rs 
b/datafusion/functions/src/core/getfield.rs
index 8d1ffb7c4c..d57ba46fb5 100644
--- a/datafusion/functions/src/core/getfield.rs
+++ b/datafusion/functions/src/core/getfield.rs
@@ -517,7 +517,7 @@ impl ScalarUDFImpl for GetFieldFunc {
         let all_keys_are_literals = args
             .iter()
             .skip(1)
-            .all(|p| matches!(p, ExpressionPlacement::Literal));
+            .all(|p| *p == ExpressionPlacement::Literal);
 
         if base_is_pushable && all_keys_are_literals {
             ExpressionPlacement::MoveTowardsLeafNodes
diff --git a/datafusion/optimizer/src/decorrelate_predicate_subquery.rs 
b/datafusion/optimizer/src/decorrelate_predicate_subquery.rs
index b9d160d555..281d2d7348 100644
--- a/datafusion/optimizer/src/decorrelate_predicate_subquery.rs
+++ b/datafusion/optimizer/src/decorrelate_predicate_subquery.rs
@@ -461,7 +461,7 @@ fn build_join(
     //
     // Additionally, if the join keys are non-nullable on both sides, we don't 
need
     // null-aware semantics because NULLs cannot exist in the data.
-    let null_aware = matches!(join_type, JoinType::LeftAnti)
+    let null_aware = join_type == JoinType::LeftAnti
         && in_predicate_opt.is_some()
         && join_keys_may_be_null(&join_filter, left.schema(), 
sub_query_alias.schema())?;
 
diff --git a/datafusion/optimizer/src/push_down_filter.rs 
b/datafusion/optimizer/src/push_down_filter.rs
index 15bb5db07d..b1c0960386 100644
--- a/datafusion/optimizer/src/push_down_filter.rs
+++ b/datafusion/optimizer/src/push_down_filter.rs
@@ -618,7 +618,7 @@ impl InferredPredicates {
     fn new(join_type: JoinType) -> Self {
         Self {
             predicates: vec![],
-            is_inner_join: matches!(join_type, JoinType::Inner),
+            is_inner_join: join_type == JoinType::Inner,
         }
     }
 
diff --git a/datafusion/physical-expr/src/expressions/case.rs 
b/datafusion/physical-expr/src/expressions/case.rs
index dac208be53..f1d867dddf 100644
--- a/datafusion/physical-expr/src/expressions/case.rs
+++ b/datafusion/physical-expr/src/expressions/case.rs
@@ -2279,7 +2279,7 @@ mod tests {
             make_lit_i32(250),
         ));
         let expr = CaseExpr::try_new(None, vec![(predicate, make_col("c2", 
1))], None)?;
-        assert!(matches!(expr.eval_method, EvalMethod::InfallibleExprOrNull));
+        assert_eq!(expr.eval_method, EvalMethod::InfallibleExprOrNull);
         match expr.evaluate(&batch)? {
             ColumnarValue::Array(array) => {
                 assert_eq!(1000, array.len());
diff --git a/datafusion/physical-expr/src/partitioning.rs 
b/datafusion/physical-expr/src/partitioning.rs
index 54e1cd3675..d24c60b63e 100644
--- a/datafusion/physical-expr/src/partitioning.rs
+++ b/datafusion/physical-expr/src/partitioning.rs
@@ -157,7 +157,7 @@ impl PartitioningSatisfaction {
     }
 
     pub fn is_subset(&self) -> bool {
-        matches!(self, Self::Subset)
+        *self == Self::Subset
     }
 }
 
diff --git a/datafusion/physical-optimizer/src/combine_partial_final_agg.rs 
b/datafusion/physical-optimizer/src/combine_partial_final_agg.rs
index 6d8e7995c1..860406118c 100644
--- a/datafusion/physical-optimizer/src/combine_partial_final_agg.rs
+++ b/datafusion/physical-optimizer/src/combine_partial_final_agg.rs
@@ -72,7 +72,7 @@ impl PhysicalOptimizerRule for CombinePartialFinalAggregate {
                 return Ok(Transformed::no(plan));
             };
 
-            let transformed = if matches!(input_agg_exec.mode(), 
AggregateMode::Partial)
+            let transformed = if *input_agg_exec.mode() == 
AggregateMode::Partial
                 && can_combine(
                     (
                         agg_exec.group_expr(),
diff --git a/datafusion/physical-optimizer/src/enforce_distribution.rs 
b/datafusion/physical-optimizer/src/enforce_distribution.rs
index 790669b5c9..2d8fbe1cfe 100644
--- a/datafusion/physical-optimizer/src/enforce_distribution.rs
+++ b/datafusion/physical-optimizer/src/enforce_distribution.rs
@@ -498,7 +498,7 @@ pub fn reorder_aggregate_keys(
         && !physical_exprs_equal(&output_exprs, parent_required)
         && let Some(positions) = expected_expr_positions(&output_exprs, 
parent_required)
         && let Some(agg_exec) = 
agg_exec.input().as_any().downcast_ref::<AggregateExec>()
-        && matches!(agg_exec.mode(), &AggregateMode::Partial)
+        && *agg_exec.mode() == AggregateMode::Partial
     {
         let group_exprs = agg_exec.group_expr().expr();
         let new_group_exprs = positions
@@ -625,7 +625,7 @@ pub fn reorder_join_keys_to_inputs(
         ..
     }) = plan_any.downcast_ref::<HashJoinExec>()
     {
-        if matches!(mode, PartitionMode::Partitioned) {
+        if *mode == PartitionMode::Partitioned {
             let (join_keys, positions) = reorder_current_join_keys(
                 extract_join_keys(on),
                 Some(left.output_partitioning()),
@@ -1264,7 +1264,7 @@ pub fn ensure_distribution(
     let is_partitioned_join = plan
         .as_any()
         .downcast_ref::<HashJoinExec>()
-        .is_some_and(|join| matches!(join.mode, PartitionMode::Partitioned))
+        .is_some_and(|join| join.mode == PartitionMode::Partitioned)
         || plan.as_any().is::<SortMergeJoinExec>();
 
     let repartition_status_flags =
diff --git a/datafusion/physical-plan/src/aggregates/mod.rs 
b/datafusion/physical-plan/src/aggregates/mod.rs
index 080c6c085e..93bc8678b0 100644
--- a/datafusion/physical-plan/src/aggregates/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/mod.rs
@@ -1116,7 +1116,7 @@ impl AggregateExec {
     /// - If yes, init one inside `AggregateExec`'s `dynamic_filter` field.
     /// - If not supported, `self.dynamic_filter` should be kept `None`
     fn init_dynamic_filter(&mut self) {
-        if (!self.group_by.is_empty()) || (!matches!(self.mode, 
AggregateMode::Partial)) {
+        if (!self.group_by.is_empty()) || (self.mode != 
AggregateMode::Partial) {
             debug_assert!(
                 self.dynamic_filter.is_none(),
                 "The current operator node does not support dynamic filter"
@@ -1492,7 +1492,7 @@ impl ExecutionPlan for AggregateExec {
         );
 
         // Include self dynamic filter when it's possible
-        if matches!(phase, FilterPushdownPhase::Post)
+        if phase == FilterPushdownPhase::Post
             && config.optimizer.enable_aggregate_dynamic_filter_pushdown
             && let Some(self_dyn_filter) = &self.dynamic_filter
         {
@@ -1515,7 +1515,7 @@ impl ExecutionPlan for AggregateExec {
 
         // If this node tried to pushdown some dynamic filter before, now we 
check
         // if the child accept the filter
-        if matches!(phase, FilterPushdownPhase::Post)
+        if phase == FilterPushdownPhase::Post
             && let Some(dyn_filter) = &self.dynamic_filter
         {
             // let child_accepts_dyn_filter = child_pushdown_result
diff --git a/datafusion/physical-plan/src/filter.rs 
b/datafusion/physical-plan/src/filter.rs
index 2af0731fb7..8cadcf9ad5 100644
--- a/datafusion/physical-plan/src/filter.rs
+++ b/datafusion/physical-plan/src/filter.rs
@@ -585,7 +585,7 @@ impl ExecutionPlan for FilterExec {
         parent_filters: Vec<Arc<dyn PhysicalExpr>>,
         _config: &ConfigOptions,
     ) -> Result<FilterDescription> {
-        if !matches!(phase, FilterPushdownPhase::Pre) {
+        if phase != FilterPushdownPhase::Pre {
             let child =
                 ChildFilterDescription::from_child(&parent_filters, 
self.input())?;
             return Ok(FilterDescription::new().with_child(child));
@@ -608,7 +608,7 @@ impl ExecutionPlan for FilterExec {
         child_pushdown_result: ChildPushdownResult,
         _config: &ConfigOptions,
     ) -> Result<FilterPushdownPropagation<Arc<dyn ExecutionPlan>>> {
-        if !matches!(phase, FilterPushdownPhase::Pre) {
+        if phase != FilterPushdownPhase::Pre {
             return 
Ok(FilterPushdownPropagation::if_all(child_pushdown_result));
         }
         // We absorb any parent filters that were not handled by our children
diff --git a/datafusion/physical-plan/src/joins/hash_join/exec.rs 
b/datafusion/physical-plan/src/joins/hash_join/exec.rs
index f39208bcb7..0f2b87c945 100644
--- a/datafusion/physical-plan/src/joins/hash_join/exec.rs
+++ b/datafusion/physical-plan/src/joins/hash_join/exec.rs
@@ -354,7 +354,7 @@ impl HashJoinExecBuilder {
 
         // Validate null_aware flag
         if null_aware {
-            if !matches!(join_type, JoinType::LeftAnti) {
+            if join_type != JoinType::LeftAnti {
                 return plan_err!(
                     "null_aware can only be true for LeftAnti joins, got 
{join_type}"
                 );
@@ -1016,7 +1016,7 @@ impl DisplayAs for HashJoinExec {
                     "".to_string()
                 };
                 let display_null_equality =
-                    if matches!(self.null_equality(), 
NullEquality::NullEqualsNull) {
+                    if self.null_equality() == NullEquality::NullEqualsNull {
                         ", NullsEqual: true"
                     } else {
                         ""
@@ -1058,7 +1058,7 @@ impl DisplayAs for HashJoinExec {
 
                 writeln!(f, "on={on}")?;
 
-                if matches!(self.null_equality(), 
NullEquality::NullEqualsNull) {
+                if self.null_equality() == NullEquality::NullEqualsNull {
                     writeln!(f, "NullsEqual: true")?;
                 }
 
@@ -1545,7 +1545,7 @@ impl ExecutionPlan for HashJoinExec {
         };
 
         // Add dynamic filters in Post phase if enabled
-        if matches!(phase, FilterPushdownPhase::Post)
+        if phase == FilterPushdownPhase::Post
             && self.allow_join_dynamic_filter_pushdown(config)
         {
             // Add actual dynamic filter to right side (probe side)
diff --git 
a/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs 
b/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs
index 04daa3698d..bb32a222de 100644
--- a/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs
+++ b/datafusion/physical-plan/src/joins/piecewise_merge_join/classic_join.rs
@@ -490,7 +490,7 @@ fn resolve_classic_join(
             // If we find a match we append all indices and move to the next 
stream row index
             match operator {
                 Operator::Gt | Operator::Lt => {
-                    if matches!(compare, Ordering::Less) {
+                    if compare == Ordering::Less {
                         batch_process_state.found = true;
                         let count = buffered_len - buffer_idx;
 
diff --git a/datafusion/physical-plan/src/joins/sort_merge_join/exec.rs 
b/datafusion/physical-plan/src/joins/sort_merge_join/exec.rs
index 8778e4154e..160a3272fb 100644
--- a/datafusion/physical-plan/src/joins/sort_merge_join/exec.rs
+++ b/datafusion/physical-plan/src/joins/sort_merge_join/exec.rs
@@ -353,7 +353,7 @@ impl DisplayAs for SortMergeJoinExec {
                     .collect::<Vec<String>>()
                     .join(", ");
                 let display_null_equality =
-                    if matches!(self.null_equality(), 
NullEquality::NullEqualsNull) {
+                    if self.null_equality() == NullEquality::NullEqualsNull {
                         ", NullsEqual: true"
                     } else {
                         ""
@@ -386,7 +386,7 @@ impl DisplayAs for SortMergeJoinExec {
                 }
                 writeln!(f, "on={on}")?;
 
-                if matches!(self.null_equality(), 
NullEquality::NullEqualsNull) {
+                if self.null_equality() == NullEquality::NullEqualsNull {
                     writeln!(f, "NullsEqual: true")?;
                 }
 
diff --git a/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs 
b/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs
index e0498821eb..37213401fd 100644
--- a/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs
+++ b/datafusion/physical-plan/src/joins/sort_merge_join/stream.rs
@@ -432,7 +432,7 @@ impl JoinedRecordBatches {
     /// Maintains invariant: N rows → N metadata entries (nulls)
     fn push_batch_with_null_metadata(&mut self, batch: RecordBatch, join_type: 
JoinType) {
         debug_assert!(
-            matches!(join_type, JoinType::Full),
+            join_type == JoinType::Full,
             "push_batch_with_null_metadata should only be called for Full 
joins"
         );
 
@@ -1081,7 +1081,7 @@ impl SortMergeJoinStream {
                 }
             }
             Ordering::Greater => {
-                if matches!(self.join_type, JoinType::Full) {
+                if self.join_type == JoinType::Full {
                     join_buffered = !self.buffered_joined;
                 };
             }
@@ -1181,7 +1181,7 @@ impl SortMergeJoinStream {
     // Applicable only in case of Full join.
     //
     fn freeze_buffered(&mut self, batch_count: usize) -> Result<()> {
-        if !matches!(self.join_type, JoinType::Full) {
+        if self.join_type != JoinType::Full {
             return Ok(());
         }
         for buffered_batch in 
self.buffered_data.batches.range_mut(..batch_count) {
@@ -1206,7 +1206,7 @@ impl SortMergeJoinStream {
         &mut self,
         buffered_batch: &mut BufferedBatch,
     ) -> Result<()> {
-        if !matches!(self.join_type, JoinType::Full) {
+        if self.join_type != JoinType::Full {
             return Ok(());
         }
 
@@ -1294,7 +1294,7 @@ impl SortMergeJoinStream {
             let filter_columns = if let Some(buffered_batch_idx) =
                 chunk.buffered_batch_idx
             {
-                if !matches!(self.join_type, JoinType::Right) {
+                if self.join_type != JoinType::Right {
                     if matches!(
                         self.join_type,
                         JoinType::LeftSemi | JoinType::LeftAnti | 
JoinType::LeftMark
@@ -1329,7 +1329,7 @@ impl SortMergeJoinStream {
                 vec![]
             };
 
-            let columns = if !matches!(self.join_type, JoinType::Right) {
+            let columns = if self.join_type != JoinType::Right {
                 left_columns.extend(right_columns);
                 left_columns
             } else {
@@ -1382,7 +1382,7 @@ impl SortMergeJoinStream {
 
                     if needs_deferred_filtering {
                         // Outer/semi/anti/mark joins: push unfiltered batch 
with metadata for deferred filtering
-                        let mask_to_use = if !matches!(self.join_type, 
JoinType::Full) {
+                        let mask_to_use = if self.join_type != JoinType::Full {
                             &mask
                         } else {
                             pre_mask
@@ -1406,7 +1406,7 @@ impl SortMergeJoinStream {
                     // all joined rows are failed on the join filter.
                     // I.e., if all rows joined from a streamed row are failed 
with the join filter,
                     // we need to join it with nulls as buffered side.
-                    if matches!(self.join_type, JoinType::Full) {
+                    if self.join_type == JoinType::Full {
                         let buffered_batch = &mut self.buffered_data.batches
                             [chunk.buffered_batch_idx.unwrap()];
 
diff --git a/datafusion/physical-plan/src/joins/sort_merge_join/tests.rs 
b/datafusion/physical-plan/src/joins/sort_merge_join/tests.rs
index 85cdcc7e7b..5163eb44ee 100644
--- a/datafusion/physical-plan/src/joins/sort_merge_join/tests.rs
+++ b/datafusion/physical-plan/src/joins/sort_merge_join/tests.rs
@@ -3103,7 +3103,7 @@ fn test_partition_statistics() -> Result<()> {
         );
         // Verify that aggregate statistics have a meaningful num_rows (not 
Absent)
         assert!(
-            !matches!(stats.num_rows, Precision::Absent),
+            stats.num_rows != Precision::Absent,
             "Aggregate stats should have meaningful num_rows for 
{join_type:?}, got {:?}",
             stats.num_rows
         );
@@ -3121,7 +3121,7 @@ fn test_partition_statistics() -> Result<()> {
         );
         // When children return unknown stats, the join's partition stats will 
be Absent
         assert!(
-            matches!(partition_stats.num_rows, Precision::Absent),
+            partition_stats.num_rows == Precision::Absent,
             "Partition stats should have Absent num_rows when children return 
unknown for {join_type:?}, got {:?}",
             partition_stats.num_rows
         );
diff --git a/datafusion/physical-plan/src/joins/utils.rs 
b/datafusion/physical-plan/src/joins/utils.rs
index 83fd418d73..34993fcdbd 100644
--- a/datafusion/physical-plan/src/joins/utils.rs
+++ b/datafusion/physical-plan/src/joins/utils.rs
@@ -739,7 +739,7 @@ fn max_distinct_count(
             {
                 let range_dc = range_dc as usize;
                 // Note that the `unwrap` calls in the below statement are 
safe.
-                return if matches!(result, Precision::Absent)
+                return if result == Precision::Absent
                     || &range_dc < result.get_value().unwrap()
                 {
                     if stats.min_value.is_exact().unwrap()
diff --git a/datafusion/physical-plan/src/sorts/sort.rs 
b/datafusion/physical-plan/src/sorts/sort.rs
index 55e1f460e1..8575cdd9a6 100644
--- a/datafusion/physical-plan/src/sorts/sort.rs
+++ b/datafusion/physical-plan/src/sorts/sort.rs
@@ -1411,7 +1411,7 @@ impl ExecutionPlan for SortExec {
         parent_filters: Vec<Arc<dyn PhysicalExpr>>,
         config: &datafusion_common::config::ConfigOptions,
     ) -> Result<FilterDescription> {
-        if !matches!(phase, FilterPushdownPhase::Post) {
+        if phase != FilterPushdownPhase::Post {
             return FilterDescription::from_children(parent_filters, 
&self.children());
         }
 
diff --git a/datafusion/physical-plan/src/union.rs 
b/datafusion/physical-plan/src/union.rs
index 8174160dc9..4ff6b1a59c 100644
--- a/datafusion/physical-plan/src/union.rs
+++ b/datafusion/physical-plan/src/union.rs
@@ -383,7 +383,7 @@ impl ExecutionPlan for UnionExec {
         // children with FilterExec and reporting all filters as handled.
         // Post phase: use default behavior to let the filter creator decide 
how to handle
         // filters that weren't fully pushed down.
-        if !matches!(phase, FilterPushdownPhase::Pre) {
+        if phase != FilterPushdownPhase::Pre {
             return 
Ok(FilterPushdownPropagation::if_all(child_pushdown_result));
         }
 
diff --git a/datafusion/pruning/src/pruning_predicate.rs 
b/datafusion/pruning/src/pruning_predicate.rs
index d0cb067442..6f6b00e80a 100644
--- a/datafusion/pruning/src/pruning_predicate.rs
+++ b/datafusion/pruning/src/pruning_predicate.rs
@@ -1273,7 +1273,7 @@ fn build_single_column_expr(
 ) -> Option<Arc<dyn PhysicalExpr>> {
     let field = schema.field_with_name(column.name()).ok()?;
 
-    if matches!(field.data_type(), &DataType::Boolean) {
+    if *field.data_type() == DataType::Boolean {
         let col_ref = Arc::new(column.clone()) as _;
 
         let min = required_columns
diff --git a/datafusion/spark/src/function/map/map_from_arrays.rs 
b/datafusion/spark/src/function/map/map_from_arrays.rs
index f6ca02e2fe..429ed272d7 100644
--- a/datafusion/spark/src/function/map/map_from_arrays.rs
+++ b/datafusion/spark/src/function/map/map_from_arrays.rs
@@ -96,9 +96,7 @@ impl ScalarUDFImpl for MapFromArrays {
 fn map_from_arrays_inner(args: &[ArrayRef]) -> Result<ArrayRef> {
     let [keys, values] = take_function_args("map_from_arrays", args)?;
 
-    if matches!(keys.data_type(), DataType::Null)
-        || matches!(values.data_type(), DataType::Null)
-    {
+    if *keys.data_type() == DataType::Null || *values.data_type() == 
DataType::Null {
         return Ok(cast(
             &NullArray::new(keys.len()),
             &map_type_from_key_value_types(
diff --git a/datafusion/spark/src/function/math/width_bucket.rs 
b/datafusion/spark/src/function/math/width_bucket.rs
index bd68c37edb..905c108197 100644
--- a/datafusion/spark/src/function/math/width_bucket.rs
+++ b/datafusion/spark/src/function/math/width_bucket.rs
@@ -238,11 +238,11 @@ macro_rules! width_bucket_kernel_impl {
                         continue;
                     }
                 };
-                if matches!(ord, std::cmp::Ordering::Equal) {
+                if ord == std::cmp::Ordering::Equal {
                     b.append_null();
                     continue;
                 }
-                let asc = matches!(ord, std::cmp::Ordering::Less);
+                let asc = ord == std::cmp::Ordering::Less;
 
                 if asc {
                     if x < l {
diff --git a/datafusion/spark/src/function/string/format_string.rs 
b/datafusion/spark/src/function/string/format_string.rs
index 8ab87196fd..3adf508895 100644
--- a/datafusion/spark/src/function/string/format_string.rs
+++ b/datafusion/spark/src/function/string/format_string.rs
@@ -598,7 +598,7 @@ impl ConversionType {
     pub fn validate(&self, arg_type: &DataType) -> Result<()> {
         match self {
             ConversionType::BooleanLower | ConversionType::BooleanUpper => {
-                if !matches!(arg_type, DataType::Boolean) {
+                if *arg_type != DataType::Boolean {
                     return exec_err!(
                         "Invalid argument type for boolean conversion: {:?}",
                         arg_type
diff --git a/datafusion/sql/src/expr/function.rs 
b/datafusion/sql/src/expr/function.rs
index 641f3bb8dc..c81575366f 100644
--- a/datafusion/sql/src/expr/function.rs
+++ b/datafusion/sql/src/expr/function.rs
@@ -122,7 +122,7 @@ impl FunctionArgs {
                 null_treatment: null_treatment.map(|v| v.into()),
                 distinct: false,
                 within_group,
-                function_without_parentheses: matches!(args, 
FunctionArguments::None),
+                function_without_parentheses: args == FunctionArguments::None,
             });
         };
 
diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs
index dd63cfce5e..307f28e8ff 100644
--- a/datafusion/sql/src/planner.rs
+++ b/datafusion/sql/src/planner.rs
@@ -713,8 +713,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             SQLDataType::Timestamp(precision, tz_info)
                 if precision.is_none() || [0, 3, 6, 
9].contains(&precision.unwrap()) =>
             {
-                let tz = if matches!(tz_info, TimezoneInfo::Tz)
-                    || matches!(tz_info, TimezoneInfo::WithTimeZone)
+                let tz = if *tz_info == TimezoneInfo::Tz
+                    || *tz_info == TimezoneInfo::WithTimeZone
                 {
                     // Timestamp With Time Zone
                     // INPUT : [SQLDataType]   TimestampTz + [Config] Time Zone
@@ -735,8 +735,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             }
             SQLDataType::Date => Ok(DataType::Date32),
             SQLDataType::Time(None, tz_info) => {
-                if matches!(tz_info, TimezoneInfo::None)
-                    || matches!(tz_info, TimezoneInfo::WithoutTimeZone)
+                if *tz_info == TimezoneInfo::None
+                    || *tz_info == TimezoneInfo::WithoutTimeZone
                 {
                     Ok(DataType::Time64(TimeUnit::Nanosecond))
                 } else {
diff --git a/datafusion/substrait/src/logical_plan/producer/expr/cast.rs 
b/datafusion/substrait/src/logical_plan/producer/expr/cast.rs
index 53d3d3e12c..6eb27fc39d 100644
--- a/datafusion/substrait/src/logical_plan/producer/expr/cast.rs
+++ b/datafusion/substrait/src/logical_plan/producer/expr/cast.rs
@@ -35,7 +35,7 @@ pub fn from_cast(
         // only the untyped(a null scalar value) null literal need this 
special handling
         // since all other kind of nulls are already typed and can be handled 
by substrait
         // e.g. null::<Int32Type> or null::<Utf8Type>
-        if matches!(lit, ScalarValue::Null) {
+        if *lit == ScalarValue::Null {
             let lit = Literal {
                 nullable: true,
                 type_variation_reference: DEFAULT_TYPE_VARIATION_REF,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to