Skip to content

Commit

Permalink
Ran cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
SarveshOO7 committed Nov 17, 2024
1 parent 4b1676d commit ba8ff26
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 22 deletions.
1 change: 1 addition & 0 deletions optd-cost-model/src/cost/agg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

29 changes: 17 additions & 12 deletions optd-persistent/src/cost_model/orm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,13 @@ impl CostModelStorageLayer for BackendManager {
.collect::<Vec<_>>();

if attr_ids.len() != attr_base_indices.len() {
return Err(BackendError::CostModel(format!(
"Not all attributes found for table_id {} and base indices {:?}",
table_id, attr_base_indices
).into()));
return Err(BackendError::CostModel(
format!(
"Not all attributes found for table_id {} and base indices {:?}",
table_id, attr_base_indices
)
.into(),
));
}

self.get_stats_for_attr(attr_ids, stat_type, epoch_id).await
Expand Down Expand Up @@ -508,10 +511,13 @@ impl CostModelStorageLayer for BackendManager {
.one(&self.db)
.await?;
if expr_exists.is_none() {
return Err(BackendError::CostModel(format!(
"physical expression id {} not found when storing cost",
physical_expression_id
).into()));
return Err(BackendError::CostModel(
format!(
"physical expression id {} not found when storing cost",
physical_expression_id
)
.into(),
));
}

// Check if epoch_id exists in Event table
Expand All @@ -521,10 +527,9 @@ impl CostModelStorageLayer for BackendManager {
.await
.unwrap();
if epoch_exists.is_none() {
return Err(BackendError::CostModel(format!(
"epoch id {} not found when storing cost",
epoch_id
).into()));
return Err(BackendError::CostModel(
format!("epoch id {} not found when storing cost", epoch_id).into(),
));
}

let new_cost = plan_cost::ActiveModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ Table predicate {
}
*/

use sea_orm_migration::{prelude::*, schema::{integer, json, pk_auto}};
use sea_orm_migration::{
prelude::*,
schema::{integer, json, pk_auto},
};

#[derive(Iden)]
pub enum Predicate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Table predicate_logical_expression_junction {

use sea_orm_migration::{prelude::*, schema::integer};

use super::{m20241029_000001_logical_expression::LogicalExpression, m20241029_000001_predicate::Predicate};
use super::{
m20241029_000001_logical_expression::LogicalExpression, m20241029_000001_predicate::Predicate,
};

#[derive(Iden)]
pub enum PredicateLogicalExpressionJunction {
Expand All @@ -19,7 +21,6 @@ pub enum PredicateLogicalExpressionJunction {
#[derive(DeriveMigrationName)]
pub struct Migration;


#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
Expand Down Expand Up @@ -53,18 +54,19 @@ impl MigrationTrait for Migration {
Index::create()
.col(PredicateLogicalExpressionJunction::LogicalExprId)
.col(PredicateLogicalExpressionJunction::PredicateId),

)
.to_owned(),
)
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(PredicateLogicalExpressionJunction::Table).to_owned())
.drop_table(
Table::drop()
.table(PredicateLogicalExpressionJunction::Table)
.to_owned(),
)
.await
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Table predicate_physical_expression_junction {

use sea_orm_migration::{prelude::*, schema::integer};

use super::{m20241029_000001_physical_expression::PhysicalExpression, m20241029_000001_predicate::Predicate};
use super::{
m20241029_000001_physical_expression::PhysicalExpression, m20241029_000001_predicate::Predicate,
};

#[derive(Iden)]
pub enum PredicatePhysicalExpressionJunction {
Expand Down

0 comments on commit ba8ff26

Please sign in to comment.