MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / explain_dataflow

Function explain_dataflow

src/adapter/src/explain.rs:50–86  ·  view source on GitHub ↗

Convenience method to derive an `ExplainContext` from the `index_imports` in the given `plan` and all other input parameters, wrap the `plan` in an `Explainable`, and finally compute and return the `explain(...)` result.

(
    mut plan: DataflowDescription<T>,
    format: ExplainFormat,
    config: &ExplainConfig,
    features: &OptimizerFeatures,
    humanizer: &dyn ExprHumanizer,
    cardinality_stats: BTreeMap<Glob

Source from the content-addressed store, hash-verified

48/// the given `plan` and all other input parameters, wrap the `plan` in an
49/// `Explainable`, and finally compute and return the `explain(...)` result.
50pub(crate) fn explain_dataflow<T>(
51 mut plan: DataflowDescription<T>,
52 format: ExplainFormat,
53 config: &ExplainConfig,
54 features: &OptimizerFeatures,
55 humanizer: &dyn ExprHumanizer,
56 cardinality_stats: BTreeMap<GlobalId, usize>,
57 target_cluster: Option<&str>,
58 dataflow_metainfo: &DataflowMetainfo<Arc<OptimizerNotice>>,
59) -> Result<String, AdapterError>
60where
61 for<'a> Explainable<'a, DataflowDescription<T>>: Explain<'a, Context = ExplainContext<'a>>,
62{
63 // Collect the list of indexes used by the dataflow at this point.
64 let used_indexes = dataflow_metainfo.used_indexes(&plan);
65
66 let optimizer_notices = OptimizerNotice::explain(
67 &dataflow_metainfo.optimizer_notices,
68 humanizer,
69 config.redacted,
70 )
71 .map_err(ExplainError::FormatError)?;
72
73 let context = ExplainContext {
74 config,
75 features,
76 humanizer,
77 cardinality_stats,
78 used_indexes,
79 finishing: Default::default(),
80 duration: Default::default(),
81 target_cluster,
82 optimizer_notices,
83 };
84
85 Ok(Explainable::new(&mut plan).explain(&format, &context)?)
86}
87
88/// Convenience method to explain a single plan.
89///

Callers 2

explain_indexMethod · 0.85

Calls 3

explainFunction · 0.85
used_indexesMethod · 0.45
explainMethod · 0.45

Tested by

no test coverage detected