Struct mz_sql::query_model::hir::hir_from_qgm::FromModel
source · struct FromModel {
id_gen: IdGen,
converted: Vec<HirRelationExpr>,
lets: Vec<(LocalId, HirRelationExpr, RelationType)>,
common_subgraphs: HashMap<BoxId, usize>,
}
Fields§
§id_gen: IdGen
Generates mz_expr::LocalId
as an alias for common expressions.
converted: Vec<HirRelationExpr>
Stack of HirRelationExpr that have been created through visiting nodes of QGM in post-order.
lets: Vec<(LocalId, HirRelationExpr, RelationType)>
Common expressions that have been given a mz_expr::LocalId
, from
oldest to most recently identified.
common_subgraphs: HashMap<BoxId, usize>
Map of (BoxIds whose HIR representation has been given a
mz_expr::LocalId
) -> (position of its HIR representation in lets
)
Implementations§
source§impl FromModel
impl FromModel
fn generate(self, model: Model) -> Result<HirRelationExpr, QGMError>
sourcefn convert_subgraph(
&mut self,
model: &Model,
box_id: &BoxId
) -> Result<(), QGMError>
fn convert_subgraph(
&mut self,
model: &Model,
box_id: &BoxId
) -> Result<(), QGMError>
Convert subgraph rooted at box_id
to HirRelationExpr.
If the box corresponding to box_id
has multiple ranging quantifiers,
the HirRelationExpr will be in self.lets
, and it can be looked up in
self.common_subgraphs
. Otherwise, it will be pushed to self.converted
.
sourcefn convert_quantifiers<'a>(
&mut self,
box: &BoundRef<'a, QueryBox>
) -> Result<(Vec<(QuantifierId, HirRelationExpr)>, Vec<(QuantifierId, HirScalarExpr)>), QGMError>
fn convert_quantifiers<'a>(
&mut self,
box: &BoundRef<'a, QueryBox>
) -> Result<(Vec<(QuantifierId, HirRelationExpr)>, Vec<(QuantifierId, HirScalarExpr)>), QGMError>
Convert the quantifiers of box
into HirRelationExpr and HirScalarExpr.
Results are returned in reverse quantifier order; the last entry in the second vector corresponds to the first subquery quantifier in the box.
sourcefn convert_projection<'a>(
&mut self,
box: &BoundRef<'a, QueryBox>,
column_map: &ColumnMap,
result: HirRelationExpr
) -> HirRelationExpr
fn convert_projection<'a>(
&mut self,
box: &BoundRef<'a, QueryBox>,
column_map: &ColumnMap,
result: HirRelationExpr
) -> HirRelationExpr
Convert the projection of a box into a Map + Project around the HirRelationExpr representing the rest of the box.
sourcefn convert_scalar(
&mut self,
expr: &BoxScalarExpr,
column_map: &ColumnMap
) -> HirScalarExpr
fn convert_scalar(
&mut self,
expr: &BoxScalarExpr,
column_map: &ColumnMap
) -> HirScalarExpr
Convert a BoxScalarExpr to HirScalarExpr.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for FromModel
impl Send for FromModel
impl Sync for FromModel
impl Unpin for FromModel
impl UnwindSafe for FromModel
Blanket Implementations§
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
.