Struct mz_sql::plan::explain::Explanation
source · pub struct Explanation<'a> {
expr_humanizer: &'a dyn ExprHumanizer,
nodes: Vec<ExplanationNode<'a>>,
finishing: Option<RowSetFinishing>,
expr_chains: HashMap<*const HirRelationExpr, u64>,
local_id_chains: HashMap<LocalId, (String, u64)>,
chain_local_ids: HashMap<u64, (String, LocalId)>,
chain: u64,
}
Expand description
An Explanation
facilitates pretty-printing of a HirRelationExpr
.
By default, the fmt::Display
implementation renders the expression as
described in the module docs. Additional information may be attached to the
explanation via the other public methods on the type.
Fields§
§expr_humanizer: &'a dyn ExprHumanizer
§nodes: Vec<ExplanationNode<'a>>
One ExplanationNode
for each HirRelationExpr
in the plan, in
left-to-right post-order.
finishing: Option<RowSetFinishing>
An optional RowSetFinishing
to mention at the end.
expr_chains: HashMap<*const HirRelationExpr, u64>
Records the chain ID that was assigned to each expression.
local_id_chains: HashMap<LocalId, (String, u64)>
Records the chain ID that was assigned to each let.
chain_local_ids: HashMap<u64, (String, LocalId)>
Records the local ID that corresponds to a chain ID, if any.
chain: u64
The ID of the current chain. Incremented while constructing the
Explanation
.
Implementations§
source§impl<'a> Explanation<'a>
impl<'a> Explanation<'a>
sourcepub fn new(
expr: &'a HirRelationExpr,
expr_humanizer: &'a dyn ExprHumanizer
) -> Explanation<'a>
pub fn new(
expr: &'a HirRelationExpr,
expr_humanizer: &'a dyn ExprHumanizer
) -> Explanation<'a>
Creates an explanation for a HirRelationExpr
.
pub fn new_internal(
expr: &'a HirRelationExpr,
expr_humanizer: &'a dyn ExprHumanizer,
id_gen: &mut IdGen,
local_id_chains: HashMap<LocalId, (String, u64)>
) -> Explanation<'a>
sourcepub fn explain_types(&mut self, params: &BTreeMap<usize, ScalarType>)
pub fn explain_types(&mut self, params: &BTreeMap<usize, ScalarType>)
Attach type information into the explanation.
fn explain_types_internal(
&mut self,
outers: &[RelationType],
params: &BTreeMap<usize, ScalarType>
)
sourcepub fn explain_row_set_finishing(&mut self, finishing: RowSetFinishing)
pub fn explain_row_set_finishing(&mut self, finishing: RowSetFinishing)
Attach a RowSetFinishing
to the explanation.
fn fmt_node(&self, f: &mut Formatter<'_>, node: &ExplanationNode<'_>) -> Result
fn fmt_scalar_expr(&self, f: &mut Formatter<'_>, expr: &HirScalarExpr) -> Result
fn fmt_aggregate_expr(
&self,
f: &mut Formatter<'_>,
expr: &AggregateExpr
) -> Result
sourcefn expr_chain(&self, expr: &HirRelationExpr) -> u64
fn expr_chain(&self, expr: &HirRelationExpr) -> u64
Retrieves the chain ID for the specified expression.
The ExplanationNode
for expr
must have already been inserted into
the explanation.
Trait Implementations§
source§impl<'a> Debug for Explanation<'a>
impl<'a> Debug for Explanation<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Explanation<'a>
impl<'a> !Send for Explanation<'a>
impl<'a> !Sync for Explanation<'a>
impl<'a> Unpin for Explanation<'a>
impl<'a> !UnwindSafe for Explanation<'a>
Blanket Implementations§
source§impl<T> DisplayExt for Twhere
T: Display,
impl<T> DisplayExt for Twhere
T: Display,
source§fn to_string_alt(&self) -> String
fn to_string_alt(&self) -> String
{:#}
) and returns it.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.