Skip to content

Commit effc881

Browse files
committed
please lints
1 parent d0b1f1f commit effc881

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

datafusion/physical-optimizer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ pub mod optimizer;
4040
pub mod output_requirements;
4141
pub mod projection_pushdown;
4242
pub use datafusion_pruning as pruning;
43+
mod nl_join_projection_pushdown;
4344
pub mod sanity_checker;
4445
pub mod topk_aggregation;
4546
pub mod update_aggr_exprs;
4647
pub mod utils;
47-
mod nl_join_projection_pushdown;
4848

4949
pub use optimizer::PhysicalOptimizerRule;

datafusion/physical-optimizer/src/nl_join_projection_pushdown.rs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
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+
118
use crate::PhysicalOptimizerRule;
219
use arrow::datatypes::{Fields, Schema, SchemaRef};
320
use 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

Comments
 (0)