mz_repr::explain

Trait ExprHumanizer

Source
pub trait ExprHumanizer: Debug {
    // Required methods
    fn humanize_id(&self, id: GlobalId) -> Option<String>;
    fn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>;
    fn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>;
    fn humanize_scalar_type(
        &self,
        ty: &ScalarType,
        postgres_compat: bool,
    ) -> String;
    fn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>;
    fn humanize_column(&self, id: GlobalId, column: usize) -> Option<String>;
    fn id_exists(&self, id: GlobalId) -> bool;

    // Provided method
    fn humanize_column_type(
        &self,
        typ: &ColumnType,
        postgres_compat: bool,
    ) -> String { ... }
}
Expand description

A trait for humanizing components of an expression.

This will be most often used as part of the rendering context type for various Display$Format implementation.

Required Methods§

Source

fn humanize_id(&self, id: GlobalId) -> Option<String>

Attempts to return a human-readable string for the relation identified by id.

Source

fn humanize_id_unqualified(&self, id: GlobalId) -> Option<String>

Same as above, but without qualifications, e.g., only foo for materialize.public.foo.

Source

fn humanize_id_parts(&self, id: GlobalId) -> Option<Vec<String>>

Like Self::humanize_id, but returns the constituent parts of the name as individual elements.

Source

fn humanize_scalar_type(&self, ty: &ScalarType, postgres_compat: bool) -> String

Returns a human-readable name for the specified scalar type. Used in, e.g., EXPLAIN and error msgs, in which case exact Postgres compatibility is less important than showing as much detail as possible. Also used in pg_typeof, where Postgres compatibility is more important.

Source

fn column_names_for_id(&self, id: GlobalId) -> Option<Vec<String>>

Returns a vector of column names for the relation identified by id.

Source

fn humanize_column(&self, id: GlobalId, column: usize) -> Option<String>

Returns the #column name for the relation identified by id.

Source

fn id_exists(&self, id: GlobalId) -> bool

Returns whether the specified id exists.

Provided Methods§

Source

fn humanize_column_type( &self, typ: &ColumnType, postgres_compat: bool, ) -> String

Returns a human-readable name for the specified column type. Used in, e.g., EXPLAIN and error msgs, in which case exact Postgres compatibility is less important than showing as much detail as possible. Also used in pg_typeof, where Postgres compatibility is more important.

Trait Implementations§

Source§

impl<'a, T> AsRef<&'a dyn ExprHumanizer> for PlanRenderingContext<'a, T>

Source§

fn as_ref(&self) -> &&'a dyn ExprHumanizer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> AsRef<&'a dyn ExprHumanizer> for RenderingContext<'a>

Source§

fn as_ref(&self) -> &&'a dyn ExprHumanizer

Converts this type into a shared reference of the (usually inferred) input type.

Implementors§