Skip to content
Draft
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
37 changes: 10 additions & 27 deletions crates/integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,23 @@ pub mod fixtures {
}
}

/// Timing and export helpers for post-ASAP plans.
/// Export helper for post-ASAP plans.
pub mod post_asap {
use asap_types::ir::export::{compile_physical_asap_dag, PhysicalASAPDAG};
use asap_types::ir::{
apply_materialization_timings, MaterializationAssignment, OperatorNode, TimingMemo,
};
use std::rc::Rc;

/// Time `root` under the default assignment (every summary computed at
/// query time). Returns the timed copy; read `node.timing` on it.
pub fn timed(root: &Rc<OperatorNode>) -> Rc<OperatorNode> {
timed_with(root, &MaterializationAssignment::all_query_time())
}

/// Time `root` with every summary maintained at ingestion time.
pub fn maintained(root: &Rc<OperatorNode>) -> Rc<OperatorNode> {
timed_with(root, &MaterializationAssignment::all_ingestion_time())
}

fn timed_with(
root: &Rc<OperatorNode>,
assignment: &MaterializationAssignment,
) -> Rc<OperatorNode> {
apply_materialization_timings(root, assignment, &mut TimingMemo::new())
.expect("materialization timing failed")
}

/// Time `root` (default assignment), then export the physical DAG.
/// Time `root` with every summary computed at query time, then export the
/// physical DAG.
pub fn post_asap_dag(root: &Rc<OperatorNode>) -> PhysicalASAPDAG {
compile_physical_asap_dag(&timed(root)).expect("post-ASAP DAG export failed")
}

/// Time `root` with every summary maintained, then export the physical DAG.
pub fn maintained_post_asap_dag(root: &Rc<OperatorNode>) -> PhysicalASAPDAG {
compile_physical_asap_dag(&maintained(root)).expect("post-ASAP DAG export failed")
let timed = apply_materialization_timings(
root,
&MaterializationAssignment::all_query_time(),
&mut TimingMemo::new(),
)
.expect("materialization timing failed");
compile_physical_asap_dag(&timed).expect("post-ASAP DAG export failed")
}
}
Loading