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

Commit fbfd4db

Browse files
authored
feat: cargo fmt and actions to force format (#63)
- cargo fmt current code - actions CI include: format check, clippy check, cargo test --------- Signed-off-by: AveryQi115 <[email protected]>
1 parent bad836e commit fbfd4db

File tree

9 files changed

+54
-34
lines changed

9 files changed

+54
-34
lines changed

Diff for: .github/workflows/CI.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
check:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions-rs/toolchain@v1
20+
with:
21+
profile: minimal
22+
components: rustfmt, clippy
23+
- name: Check code format
24+
uses: actions-rs/cargo@v1
25+
with:
26+
command: fmt
27+
args: --all -- --check
28+
- name: Clippy
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: clippy
32+
args: --workspace --all-targets --all-features --locked -- -D warnings
33+
- name: Test
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: test
37+
args: --no-fail-fast --workspace --all-features --locked
38+

Diff for: .github/workflows/lint_and_test.yaml

-15
This file was deleted.

Diff for: datafusion-optd-cli/tests/cli_integration.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ fn cli_test_tpch() {
5757
cmd.current_dir(".."); // all paths in `test.sql` assume we're in the base dir of the repo
5858
cmd.args(["--enable-logical", "--file", "tpch/test.sql"]);
5959
let status = cmd.status().unwrap();
60-
assert!(status.success(), "should not have crashed when running tpch");
61-
}
60+
assert!(
61+
status.success(),
62+
"should not have crashed when running tpch"
63+
);
64+
}

Diff for: optd-core/src/cascades/optimizer.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ 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-
self
218-
.memo
219-
.get_best_group_binding(group_id, &mut on_produce)
217+
self.memo.get_best_group_binding(group_id, &mut on_produce)
220218
}
221219

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

Diff for: optd-core/src/cascades/tasks/optimize_inputs.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,7 @@ impl<T: RelNodeTyp> Task<T> for OptimizeInputsTask {
243243
} else {
244244
self.update_winner(
245245
&cost.sum(
246-
&cost.compute_cost(
247-
&expr.typ,
248-
&expr.data,
249-
&input_cost,
250-
Some(context),
251-
),
246+
&cost.compute_cost(&expr.typ, &expr.data, &input_cost, Some(context)),
252247
&input_cost,
253248
),
254249
optimizer,

Diff for: optd-core/src/heuristics/optimizer.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ fn match_node<T: RelNodeTyp>(
4949
assert!(res.is_none(), "dup pick");
5050
}
5151
RuleMatcher::PickMany { pick_to } => {
52-
let res = pick.insert(
53-
*pick_to,
54-
RelNode::new_list(node.children[idx..].to_vec()),
55-
);
52+
let res = pick.insert(*pick_to, RelNode::new_list(node.children[idx..].to_vec()));
5653
assert!(res.is_none(), "dup pick");
5754
should_end = true;
5855
}

Diff for: optd-datafusion-bridge/src/from_optd.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ impl OptdPlanContext<'_> {
351351
Schema::new_with_metadata(fields, HashMap::new())
352352
};
353353

354-
let physical_expr = Self::conv_from_optd_expr(node.cond(), &Arc::new(filter_schema.clone()))?;
354+
let physical_expr =
355+
Self::conv_from_optd_expr(node.cond(), &Arc::new(filter_schema.clone()))?;
355356

356357
if let JoinType::Cross = node.join_type() {
357358
return Ok(Arc::new(CrossJoinExec::new(left_exec, right_exec))
@@ -495,7 +496,10 @@ impl OptdPlanContext<'_> {
495496
result.with_context(|| format!("when processing {}", rel_node_dbg))
496497
}
497498

498-
pub async fn conv_from_optd(&mut self, root_rel: OptRelNodeRef) -> Result<Arc<dyn ExecutionPlan>> {
499+
pub async fn conv_from_optd(
500+
&mut self,
501+
root_rel: OptRelNodeRef,
502+
) -> Result<Arc<dyn ExecutionPlan>> {
499503
self.conv_from_optd_plan_node(PlanNode::from_rel_node(root_rel).unwrap())
500504
.await
501505
}

Diff for: optd-datafusion-repr/src/rules/joins.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn apply_projection_pull_up_join(
342342
.into_rel_node(),
343343
);
344344
}
345-
345+
346346
Expr::from_rel_node(
347347
RelNode {
348348
typ: expr.typ.clone(),

Diff for: rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
stable
1+
1.76.0

0 commit comments

Comments
 (0)