11//! Issue #171 — composing exact operators with summary plans across
22//! explicit update/evaluation boundaries, end to end through
33//! `search_workload_with` → `candidate_selection::global_selection` →
4- //! `GlobalSelection::assemble_selected_dag` → `dag_export` .
4+ //! `GlobalSelection::assemble_selected_dag`.
55//!
66//! Covers the issue's integration matrix: both nesting directions, grouped
77//! fine-to-coarse and identity folds, one inner summary shared by several
1313use std:: rc:: Rc ;
1414
1515use asap_integration_tests:: fixtures:: lower_promql;
16- use asap_integration_tests:: post_asap:: { maintained, post_asap_dag , timed} ;
16+ use asap_integration_tests:: post_asap:: { maintained, timed} ;
1717use asap_logical_optimizer:: pass1:: exact_composition:: ExactOperation ;
1818use asap_logical_optimizer:: pass1:: replacement:: {
1919 default_strategies, search_workload_with, ASAPStrategies , Replacement , ReplacementProvenance ,
@@ -25,11 +25,9 @@ use asap_plan_selection::cost::cost_model::{
2525 CostProvenance , CostUnit , ExactCompositionCostInputs , ExactCompositionCostRequest ,
2626} ;
2727use asap_plan_selection:: { CostModel , DefaultCostModel , EvaluationRate } ;
28- use asap_types:: dag_export;
29- use asap_types:: ir:: data_state;
30- use asap_types:: ir:: operator:: { default_quantile, AggIntent } ;
31- use asap_types:: ir:: operator:: { Reduction , Source } ;
32- use asap_types:: ir:: physical_export:: PhysicalASAPOperatorPayload ;
28+ use asap_types:: ir:: operator:: agg_intent:: { default_quantile, AggIntent } ;
29+ use asap_types:: ir:: operator:: operator_properties:: { Reduction , Source } ;
30+ use asap_types:: ir:: properties:: timing:: data_state;
3331use asap_types:: ir:: properties:: { ExecutionDataState , ExecutionTiming } ;
3432use asap_types:: ir:: schema:: { DataType , Field , Schema } ;
3533use asap_types:: ir:: schema:: { ExactKind , FieldDataType , SketchAlgorithm , SummaryUpdate } ;
@@ -703,43 +701,6 @@ fn missing_cost_statistics_preserve_the_conservative_retain_exact() {
703701 . any( |e| e. kind == ExplanationKind :: ExactComposition ) ) ;
704702}
705703
706- // ── DAG export: explicit stage, schema, provenance ───────────────────────
707-
708- #[ test]
709- fn dag_export_carries_explicit_stage_and_plain_schema_for_a_composed_plan ( ) {
710- let root = agg ( vec ! [ 0 ] , AggIntent :: Max { col : None } , fine_quantile ( ) ) ;
711- let space = plan ( vec ! [ ( "q" , root) ] ) ;
712- let root = & space. roots [ 0 ] . 1 ;
713- let composed = global_selection ( & space, & StatsModel )
714- . assemble_selected_dag ( root)
715- . unwrap ( )
716- . unwrap ( ) ;
717- let dag = dag_export:: export_summary ( & composed) ;
718- let node = & dag. nodes [ dag. root as usize ] ;
719- assert_eq ! ( node. kind, "aggregate" ) ;
720- assert ! ( node. detail[ "measures" ] . is_array( ) ) ;
721- // Timing is explicit in the wire-6 DAG: the root is a relational
722- // aggregate placed at query time.
723- let wire = post_asap_dag ( & composed) ;
724- let wire_root = wire. nodes . iter ( ) . find ( |n| n. id == wire. roots [ 0 ] ) . unwrap ( ) ;
725- assert ! ( matches!(
726- wire_root. payload,
727- PhysicalASAPOperatorPayload :: NonASAP ( NonASAPOp :: Aggregate { .. } )
728- ) ) ;
729- assert_eq ! ( wire_root. output_state. timing, ExecutionTiming :: QueryTime ) ;
730-
731- // Pre-ASAP export of the same target still describes the same columns.
732- let pre = dag_export:: export ( root) ;
733- let pre_root = & pre. nodes [ pre. root as usize ] ;
734- let pre_cols: Vec < String > = pre_root. schema . as_ref ( ) . unwrap ( ) [ "fields" ]
735- . as_array ( )
736- . unwrap ( )
737- . iter ( )
738- . map ( |c| c[ "name" ] . as_str ( ) . unwrap ( ) . to_string ( ) )
739- . collect ( ) ;
740- assert_eq ! ( pre_cols, names( & composed) ) ;
741- }
742-
743704/// The PromQL front end produces the exact issue shape and it composes.
744705#[ test]
745706fn promql_max_by_zone_over_quantile_over_time_composes ( ) {
0 commit comments