1+ // Licensed to the Apache Software Foundation (ASF) under one
2+ // or more contributor license agreements. See the NOTICE file
3+ // distributed with this work for additional information
4+ // regarding copyright ownership. The ASF licenses this file
5+ // to you under the Apache License, Version 2.0 (the
6+ // "License"); you may not use this file except in compliance
7+ // with the License. You may obtain a copy of the License at
8+ //
9+ // http://www.apache.org/licenses/LICENSE-2.0
10+ //
11+ // Unless required by applicable law or agreed to in writing,
12+ // software distributed under the License is distributed on an
13+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ // KIND, either express or implied. See the License for the
15+ // specific language governing permissions and limitations
16+ // under the License.
17+
118use crate :: PhysicalOptimizerRule ;
219use arrow:: datatypes:: { Fields , Schema , SchemaRef } ;
320use datafusion_common:: alias:: AliasGenerator ;
@@ -170,7 +187,7 @@ fn try_push_down_projection(
170187 config : & ConfigOptions ,
171188 alias_generator : & AliasGenerator ,
172189) -> Result < Transformed < ( Arc < dyn ExecutionPlan > , JoinFilter ) > > {
173- let expr = join_filter. expression ( ) . clone ( ) ;
190+ let expr = Arc :: clone ( join_filter. expression ( ) ) ;
174191 let original_plan_schema = plan. schema ( ) ;
175192 let mut rewriter = JoinFilterRewriter :: new (
176193 join_side,
@@ -195,8 +212,8 @@ fn try_push_down_projection(
195212 . intermediate_column_indices
196213 . iter ( )
197214 . map ( |ci| match ci. side {
198- JoinSide :: Left => lhs_schema. fields [ ci. index ] . clone ( ) ,
199- JoinSide :: Right => rhs_schema. fields [ ci. index ] . clone ( ) ,
215+ JoinSide :: Left => Arc :: clone ( & lhs_schema. fields [ ci. index ] ) ,
216+ JoinSide :: Right => Arc :: clone ( & rhs_schema. fields [ ci. index ] ) ,
200217 JoinSide :: None => unreachable ! ( "Mark join not supported" ) ,
201218 } )
202219 . collect :: < Fields > ( ) ;
@@ -754,15 +771,15 @@ mod test {
754771 Arc :: new ( Column :: new ( "a" , 0 ) ) ,
755772 Operator :: Plus ,
756773 lit ( 1 ) ,
757- & join_schema,
774+ join_schema,
758775 ) ?;
759776 let right_expr = binary (
760777 Arc :: new ( Column :: new ( "x" , 1 ) ) ,
761778 Operator :: Plus ,
762779 lit ( 1 ) ,
763- & join_schema,
780+ join_schema,
764781 ) ?;
765- binary ( left_expr, Operator :: Gt , right_expr, & join_schema)
782+ binary ( left_expr, Operator :: Gt , right_expr, join_schema)
766783 }
767784
768785 fn a_plus_rand_greater_than_x ( join_schema : & Schema ) -> Result < Arc < dyn PhysicalExpr > > {
@@ -779,15 +796,15 @@ mod test {
779796 join_schema,
780797 ) ?;
781798 let right_expr = Arc :: new ( Column :: new ( "x" , 1 ) ) ;
782- binary ( left_expr, Operator :: Gt , right_expr, & join_schema)
799+ binary ( left_expr, Operator :: Gt , right_expr, join_schema)
783800 }
784801
785802 fn a_greater_than_x ( join_schema : & Schema ) -> Result < Arc < dyn PhysicalExpr > > {
786803 binary (
787804 Arc :: new ( Column :: new ( "a" , 0 ) ) ,
788805 Operator :: Gt ,
789806 Arc :: new ( Column :: new ( "x" , 1 ) ) ,
790- & join_schema,
807+ join_schema,
791808 )
792809 }
793810
@@ -798,14 +815,14 @@ mod test {
798815 Arc :: new ( Column :: new ( "a" , 0 ) ) ,
799816 Operator :: Plus ,
800817 Arc :: new ( Column :: new ( "b" , 1 ) ) ,
801- & join_schema,
818+ join_schema,
802819 ) ?;
803820 let rhs = binary (
804821 Arc :: new ( Column :: new ( "x" , 2 ) ) ,
805822 Operator :: Plus ,
806823 Arc :: new ( Column :: new ( "z" , 3 ) ) ,
807- & join_schema,
824+ join_schema,
808825 ) ?;
809- binary ( lhs, Operator :: Gt , rhs, & join_schema)
826+ binary ( lhs, Operator :: Gt , rhs, join_schema)
810827 }
811828}
0 commit comments