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

feat: cargo fmt and actions to force format #63

Merged
merged 5 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustfmt, clippy
- name: Check code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets --all-features --locked -- -D warnings
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast --workspace --all-features --locked

15 changes: 0 additions & 15 deletions .github/workflows/lint_and_test.yaml

This file was deleted.

7 changes: 5 additions & 2 deletions datafusion-optd-cli/tests/cli_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@ fn cli_test_tpch() {
cmd.current_dir(".."); // all paths in `test.sql` assume we're in the base dir of the repo
cmd.args(["--enable-logical", "--file", "tpch/test.sql"]);
let status = cmd.status().unwrap();
assert!(status.success(), "should not have crashed when running tpch");
}
assert!(
status.success(),
"should not have crashed when running tpch"
);
}
4 changes: 1 addition & 3 deletions optd-core/src/cascades/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ impl<T: RelNodeTyp> CascadesOptimizer<T> {
group_id: GroupId,
mut on_produce: impl FnMut(RelNodeRef<T>, GroupId) -> RelNodeRef<T>,
) -> Result<RelNodeRef<T>> {
self
.memo
.get_best_group_binding(group_id, &mut on_produce)
self.memo.get_best_group_binding(group_id, &mut on_produce)
}

fn fire_optimize_tasks(&mut self, group_id: GroupId) -> Result<()> {
Expand Down
7 changes: 1 addition & 6 deletions optd-core/src/cascades/tasks/optimize_inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,7 @@ impl<T: RelNodeTyp> Task<T> for OptimizeInputsTask {
} else {
self.update_winner(
&cost.sum(
&cost.compute_cost(
&expr.typ,
&expr.data,
&input_cost,
Some(context),
),
&cost.compute_cost(&expr.typ, &expr.data, &input_cost, Some(context)),
&input_cost,
),
optimizer,
Expand Down
5 changes: 1 addition & 4 deletions optd-core/src/heuristics/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ fn match_node<T: RelNodeTyp>(
assert!(res.is_none(), "dup pick");
}
RuleMatcher::PickMany { pick_to } => {
let res = pick.insert(
*pick_to,
RelNode::new_list(node.children[idx..].to_vec()),
);
let res = pick.insert(*pick_to, RelNode::new_list(node.children[idx..].to_vec()));
assert!(res.is_none(), "dup pick");
should_end = true;
}
Expand Down
8 changes: 6 additions & 2 deletions optd-datafusion-bridge/src/from_optd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ impl OptdPlanContext<'_> {
Schema::new_with_metadata(fields, HashMap::new())
};

let physical_expr = Self::conv_from_optd_expr(node.cond(), &Arc::new(filter_schema.clone()))?;
let physical_expr =
Self::conv_from_optd_expr(node.cond(), &Arc::new(filter_schema.clone()))?;

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

pub async fn conv_from_optd(&mut self, root_rel: OptRelNodeRef) -> Result<Arc<dyn ExecutionPlan>> {
pub async fn conv_from_optd(
&mut self,
root_rel: OptRelNodeRef,
) -> Result<Arc<dyn ExecutionPlan>> {
self.conv_from_optd_plan_node(PlanNode::from_rel_node(root_rel).unwrap())
.await
}
Expand Down
2 changes: 1 addition & 1 deletion optd-datafusion-repr/src/rules/joins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ fn apply_projection_pull_up_join(
.into_rel_node(),
);
}

Expr::from_rel_node(
RelNode {
typ: expr.typ.clone(),
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
stable
1.76.0