@@ -498,7 +498,7 @@ impl DefaultPhysicalPlanner {
498498 output_schema,
499499 } ) => {
500500 let output_schema = Arc :: clone ( output_schema. inner ( ) ) ;
501- self . plan_describe ( Arc :: clone ( schema) , output_schema) ?
501+ self . plan_describe ( & Arc :: clone ( schema) , output_schema) ?
502502 }
503503
504504 // 1 Child
@@ -2246,6 +2246,7 @@ impl DefaultPhysicalPlanner {
22462246
22472247 /// Optimize a physical plan by applying each physical optimizer,
22482248 /// calling observer(plan, optimizer after each one)
2249+ #[ expect( clippy:: needless_pass_by_value) ]
22492250 pub fn optimize_physical_plan < F > (
22502251 & self ,
22512252 plan : Arc < dyn ExecutionPlan > ,
@@ -2280,7 +2281,7 @@ impl DefaultPhysicalPlanner {
22802281
22812282 // This only checks the schema in release build, and performs additional checks in debug mode.
22822283 OptimizationInvariantChecker :: new ( optimizer)
2283- . check ( & new_plan, before_schema) ?;
2284+ . check ( & new_plan, & before_schema) ?;
22842285
22852286 debug ! (
22862287 "Optimized physical plan by {}:\n {}\n " ,
@@ -2313,7 +2314,7 @@ impl DefaultPhysicalPlanner {
23132314 // return an record_batch which describes a table's schema.
23142315 fn plan_describe (
23152316 & self ,
2316- table_schema : Arc < Schema > ,
2317+ table_schema : & Arc < Schema > ,
23172318 output_schema : Arc < Schema > ,
23182319 ) -> Result < Arc < dyn ExecutionPlan > > {
23192320 let mut column_names = StringBuilder :: new ( ) ;
@@ -2516,10 +2517,10 @@ impl<'a> OptimizationInvariantChecker<'a> {
25162517 pub fn check (
25172518 & mut self ,
25182519 plan : & Arc < dyn ExecutionPlan > ,
2519- previous_schema : Arc < Schema > ,
2520+ previous_schema : & Arc < Schema > ,
25202521 ) -> Result < ( ) > {
25212522 // if the rule is not permitted to change the schema, confirm that it did not change.
2522- if self . rule . schema_check ( ) && plan. schema ( ) != previous_schema {
2523+ if self . rule . schema_check ( ) && plan. schema ( ) != * previous_schema {
25232524 internal_err ! ( "PhysicalOptimizer rule '{}' failed. Schema mismatch. Expected original schema: {:?}, got new schema: {:?}" ,
25242525 self . rule. name( ) ,
25252526 previous_schema,
@@ -3709,20 +3710,20 @@ digraph {
37093710
37103711 // Test: check should pass with same schema
37113712 let equal_schema = ok_plan. schema ( ) ;
3712- OptimizationInvariantChecker :: new ( & rule) . check ( & ok_plan, equal_schema) ?;
3713+ OptimizationInvariantChecker :: new ( & rule) . check ( & ok_plan, & equal_schema) ?;
37133714
37143715 // Test: should fail with schema changed
37153716 let different_schema =
37163717 Arc :: new ( Schema :: new ( vec ! [ Field :: new( "a" , DataType :: Boolean , false ) ] ) ) ;
37173718 let expected_err = OptimizationInvariantChecker :: new ( & rule)
3718- . check ( & ok_plan, different_schema)
3719+ . check ( & ok_plan, & different_schema)
37193720 . unwrap_err ( ) ;
37203721 assert ! ( expected_err. to_string( ) . contains( "PhysicalOptimizer rule 'OptimizerRuleWithSchemaCheck' failed. Schema mismatch. Expected original schema" ) ) ;
37213722
37223723 // Test: should fail when extension node fails it's own invariant check
37233724 let failing_node: Arc < dyn ExecutionPlan > = Arc :: new ( InvariantFailsExtensionNode ) ;
37243725 let expected_err = OptimizationInvariantChecker :: new ( & rule)
3725- . check ( & failing_node, ok_plan. schema ( ) )
3726+ . check ( & failing_node, & ok_plan. schema ( ) )
37263727 . unwrap_err ( ) ;
37273728 assert ! ( expected_err
37283729 . to_string( )
@@ -3735,7 +3736,7 @@ digraph {
37353736 Arc :: clone( & child) ,
37363737 ] ) ?;
37373738 let expected_err = OptimizationInvariantChecker :: new ( & rule)
3738- . check ( & invalid_plan, ok_plan. schema ( ) )
3739+ . check ( & invalid_plan, & ok_plan. schema ( ) )
37393740 . unwrap_err ( ) ;
37403741 assert ! ( expected_err
37413742 . to_string( )
0 commit comments