Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 5c2fd60

Browse files
committed
clippy fix
1 parent e422666 commit 5c2fd60

File tree

12 files changed

+26
-26
lines changed

12 files changed

+26
-26
lines changed

optd-adaptive-demo/src/bin/optd-adaptive-three-join.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async fn main() -> Result<()> {
8484
)
8585
.await;
8686

87-
let mut data_progress = vec![5; 3];
87+
let mut data_progress = [5; 3];
8888
let mut iter = 0;
8989

9090
fn do_insert(table: usize, begin: usize, end: usize, repeat: usize) -> String {

optd-core/src/cascades/memo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<T: RelNodeTyp> Memo<T> {
167167
unreachable!("not found {}", memo_node)
168168
};
169169
let group_id = self.get_group_id_of_expr_id(expr_id);
170-
return (group_id, expr_id);
170+
(group_id, expr_id)
171171
}
172172

173173
fn infer_properties(

optd-core/src/cascades/optimizer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ impl<T: RelNodeTyp> CascadesOptimizer<T> {
214214
group_id: GroupId,
215215
mut on_produce: impl FnMut(RelNodeRef<T>, GroupId) -> RelNodeRef<T>,
216216
) -> Result<RelNodeRef<T>> {
217-
Ok(self
217+
self
218218
.memo
219-
.get_best_group_binding(group_id, &mut on_produce)?)
219+
.get_best_group_binding(group_id, &mut on_produce)
220220
}
221221

222222
fn fire_optimize_tasks(&mut self, group_id: GroupId) -> Result<()> {

optd-core/src/cascades/tasks/optimize_inputs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<T: RelNodeTyp> Task<T> for OptimizeInputsTask {
153153
};
154154
if self.should_terminate(
155155
cost.sum(
156-
&cost.compute_cost(&expr.typ, &expr.data, &input_cost, Some(context.clone())),
156+
&cost.compute_cost(&expr.typ, &expr.data, &input_cost, Some(context)),
157157
&input_cost,
158158
)
159159
.0[0],
@@ -177,7 +177,7 @@ impl<T: RelNodeTyp> Task<T> for OptimizeInputsTask {
177177
&expr.typ,
178178
&expr.data,
179179
&input_cost,
180-
Some(context.clone()),
180+
Some(context),
181181
),
182182
&input_cost,
183183
)
@@ -248,7 +248,7 @@ impl<T: RelNodeTyp> Task<T> for OptimizeInputsTask {
248248
&expr.typ,
249249
&expr.data,
250250
&input_cost,
251-
Some(context.clone()),
251+
Some(context),
252252
),
253253
&input_cost,
254254
),

optd-core/src/heuristics/optimizer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn match_node<T: RelNodeTyp>(
5151
RuleMatcher::PickMany { pick_to } => {
5252
let res = pick.insert(
5353
*pick_to,
54-
RelNode::new_list(node.children[idx..].to_vec()).into(),
54+
RelNode::new_list(node.children[idx..].to_vec()),
5555
);
5656
assert!(res.is_none(), "dup pick");
5757
should_end = true;
@@ -124,7 +124,7 @@ impl<T: RelNodeTyp> HeuristicsOptimizer<T> {
124124
for rule in self.rules.as_ref() {
125125
let matcher = rule.matcher();
126126
if let Some(picks) = match_and_pick(matcher, root_rel.clone()) {
127-
let mut results = rule.apply(&self, picks);
127+
let mut results = rule.apply(self, picks);
128128
assert_eq!(results.len(), 1);
129129
root_rel = results.remove(0).into();
130130
}

optd-datafusion-bridge/src/from_optd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn from_optd_schema(optd_schema: &OptdSchema) -> Schema {
4949
.0
5050
.iter()
5151
.enumerate()
52-
.map(|(i, typ)| Field::new(&format!("c{}", i), match_type(typ), false))
52+
.map(|(i, typ)| Field::new(format!("c{}", i), match_type(typ), false))
5353
.collect();
5454
Schema::new(fields)
5555
}
@@ -108,7 +108,7 @@ impl OptdPlanContext<'_> {
108108
false,
109109
&args,
110110
&[],
111-
&context,
111+
context,
112112
"<agg_func>",
113113
)?)
114114
}

optd-datafusion-bridge/src/into_optd.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl OptdPlanContext<'_> {
7272
}
7373
ScalarValue::Int64(x) => {
7474
let x = x.as_ref().unwrap();
75-
Ok(ConstantExpr::int(*x as i64).into_expr())
75+
Ok(ConstantExpr::int(*x).into_expr())
7676
}
7777
ScalarValue::Date32(x) => {
7878
let x = x.as_ref().unwrap();
@@ -97,8 +97,8 @@ impl OptdPlanContext<'_> {
9797
let when_then_expr = &x.when_then_expr;
9898
assert_eq!(when_then_expr.len(), 1);
9999
let (when_expr, then_expr) = &when_then_expr[0];
100-
let when_expr = self.into_optd_expr(&when_expr, context)?;
101-
let then_expr = self.into_optd_expr(&then_expr, context)?;
100+
let when_expr = self.into_optd_expr(when_expr, context)?;
101+
let then_expr = self.into_optd_expr(then_expr, context)?;
102102
let else_expr = self.into_optd_expr(x.else_expr.as_ref().unwrap(), context)?;
103103
assert!(x.expr.is_none());
104104
Ok(FuncExpr::new(
@@ -226,20 +226,20 @@ impl OptdPlanContext<'_> {
226226

227227
match node.filter {
228228
Some(DFExpr::Literal(ScalarValue::Boolean(Some(val)))) => {
229-
return Ok(LogicalJoin::new(
229+
Ok(LogicalJoin::new(
230230
left,
231231
right,
232232
ConstantExpr::bool(val).into_expr(),
233233
join_type,
234-
));
234+
))
235235
}
236236
None => {
237-
return Ok(LogicalJoin::new(
237+
Ok(LogicalJoin::new(
238238
left,
239239
right,
240240
ConstantExpr::bool(true).into_expr(),
241241
join_type,
242-
));
242+
))
243243
}
244244
_ => bail!("unsupported join filter: {:?}", node.filter),
245245
}

optd-datafusion-repr/src/plan_nodes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl PlanNode {
207207
}
208208

209209
pub fn from_group(rel_node: OptRelNodeRef) -> Self {
210-
return Self(rel_node);
210+
Self(rel_node)
211211
}
212212
}
213213

optd-datafusion-repr/src/rules/joins.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,16 @@ fn apply_projection_pull_up_join(
342342
.into_rel_node(),
343343
);
344344
}
345-
let expr = Expr::from_rel_node(
345+
346+
Expr::from_rel_node(
346347
RelNode {
347348
typ: expr.typ.clone(),
348349
children,
349350
data: expr.data.clone(),
350351
}
351352
.into(),
352353
)
353-
.unwrap();
354-
expr
354+
.unwrap()
355355
}
356356

357357
let left = Arc::new(left.clone());

optd-sqlplannertest/src/bin/planner_test_apply.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use anyhow::Result;
66
async fn main() -> Result<()> {
77
sqlplannertest::planner_test_apply(
88
Path::new(env!("CARGO_MANIFEST_DIR")).join("tests"),
9-
|| async { Ok(optd_sqlplannertest::DatafusionDb::new().await?) },
9+
|| async { optd_sqlplannertest::DatafusionDb::new().await },
1010
)
1111
.await?;
1212
Ok(())

0 commit comments

Comments
 (0)