Skip to content

Commit

Permalink
feat: working on minimizing work
Browse files Browse the repository at this point in the history
  • Loading branch information
benfdking committed May 22, 2024
1 parent 98e292e commit 727dc56
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/core/src/automatic_branching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ pub async fn derive_sha256_file_contents(
Ok(HEXLOWER.encode(digest.as_ref()))
}

/// derive_hash_views returns table names for every model
/// and seed inside of the project that is passed in. The returned type is a map from the model
/// derive_hash_views returns table names for every model/snapshot and seed inside
/// of the project that is passed in. The returned type is a map from the model
/// to a tuple of the model hash and sql statements required to create the view.
pub fn derive_hash_views<'a>(
database: &impl DatabaseQueryGenerator,
Expand Down
37 changes: 37 additions & 0 deletions rust/core/src/automatic_branching_build_cached.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use crate::{
automatic_branching::{derive_hash_views, is_cache_full_path},
databases::DatabaseQueryGenerator,
file_system::FileSystem,
graph::project_to_graph,
project::project_and_fs_to_sql_for_views,
};
use quary_proto::Project;
use std::collections::{BTreeMap, BTreeSet, HashSet};

fn build_only_non_cached_things(
project: &Project,
file_system: &impl FileSystem,
database: &impl DatabaseQueryGenerator,
view_paths_in_target: HashSet<String>,
) -> Result<BTreeMap<String, Vec<String>>, String> {
let filtered_cache_views = view_paths_in_target
.into_iter()
.map(|name| {
let is_cache = is_cache_full_path(database, &name)?;
Ok((name, is_cache))
})
.collect::<Result<BTreeMap<String, bool>, String>>()?
.into_iter()
.filter(|(_, is_cache)| !is_cache)
.collect::<BTreeSet<_>>();

let views_to_create =
project_and_fs_to_sql_for_views(project, file_system, database, false, false);

let graph = project_to_graph(project.clone());
let hashed_views = derive_hash_views(database, project, graph);

Check failure on line 32 in rust/core/src/automatic_branching_build_cached.rs

View workflow job for this annotation

GitHub Actions / Rust Test

mismatched types



unimplemented!();
}
1 change: 1 addition & 0 deletions rust/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
extern crate core;

pub mod automatic_branching;
pub mod automatic_branching_build_cached;
pub mod chart;
pub mod config;
pub mod database_bigquery;
Expand Down

0 comments on commit 727dc56

Please sign in to comment.