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

Commit

Permalink
cargo fmt and actions to force format
Browse files Browse the repository at this point in the history
Signed-off-by: AveryQi115 <[email protected]>
  • Loading branch information
AveryQi115 committed Feb 12, 2024
1 parent bad836e commit 1ae1086
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 18 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/rustfmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on: pull_request

name: Rustfmt

jobs:
format:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
mode: review
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

0 comments on commit 1ae1086

Please sign in to comment.