mz_adapter/explain/
fast_path.rs1use std::collections::BTreeMap;
13
14use mz_expr::explain::{ExplainContext, ExplainMultiPlan};
15use mz_repr::explain::{AnnotatedPlan, Explain, ExplainError, UnsupportedFormat};
16
17use crate::coord::peek::FastPathPlan;
18use crate::explain::Explainable;
19
20impl<'a> Explain<'a> for Explainable<'a, FastPathPlan> {
21 type Context = ExplainContext<'a>;
22
23 type Text = ExplainMultiPlan<'a, FastPathPlan>;
24
25 type Json = ExplainMultiPlan<'a, FastPathPlan>;
26
27 type Dot = UnsupportedFormat;
28
29 fn explain_text(&'a mut self, context: &'a Self::Context) -> Result<Self::Text, ExplainError> {
30 self.as_explain_multi_plan(context)
31 }
32
33 fn explain_json(&'a mut self, context: &'a Self::Context) -> Result<Self::Text, ExplainError> {
34 self.as_explain_multi_plan(context)
35 }
36}
37
38impl<'a> Explainable<'a, FastPathPlan> {
39 fn as_explain_multi_plan(
40 &'a self,
41 context: &'a ExplainContext<'a>,
42 ) -> Result<ExplainMultiPlan<'a, FastPathPlan>, ExplainError> {
43 let plans = vec![(
44 "Explained Query (fast path)".to_string(),
45 AnnotatedPlan {
46 plan: self.0,
47 annotations: BTreeMap::default(),
48 },
49 )];
50
51 let sources = vec![];
52
53 Ok(ExplainMultiPlan {
54 context,
55 sources,
56 plans,
57 })
58 }
59}