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
| 48 | /// the given `plan` and all other input parameters, wrap the `plan` in an |
| 49 | /// `Explainable`, and finally compute and return the `explain(...)` result. |
| 50 | pub(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> |
| 60 | where |
| 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 | /// |
no test coverage detected