Struct mz_sql::query_model::hir::qgm_from_hir::FromHir
source · Fields§
§model: Model
§context_stack: Vec<BoxId>
The stack of context boxes for resolving offset-based column references.
gets_seen: HashMap<Id, BoxId>
Track the BoxId
that represents each HirRelationExpr::Get expression
we have seen so far.
Implementations§
source§impl FromHir
impl FromHir
sourcefn generate(self, expr: HirRelationExpr) -> Result<Model, QGMError>
fn generate(self, expr: HirRelationExpr) -> Result<Model, QGMError>
Generates a Query Graph Model for representing the given query.
sourcefn generate_select(&mut self, expr: HirRelationExpr) -> Result<BoxId, QGMError>
fn generate_select(&mut self, expr: HirRelationExpr) -> Result<BoxId, QGMError>
Generates a sub-graph representing the given expression, ensuring that the resulting graph starts with a Select box.
sourcefn generate_internal(&mut self, expr: HirRelationExpr) -> Result<BoxId, QGMError>
fn generate_internal(&mut self, expr: HirRelationExpr) -> Result<BoxId, QGMError>
Generates a sub-graph representing the given expression.
sourcefn wrap_within_select(&mut self, box_id: BoxId) -> BoxId
fn wrap_within_select(&mut self, box_id: BoxId) -> BoxId
Returns a Select box ranging over the given box, projecting all of its columns.
sourcefn generate_expr(
&mut self,
expr: HirScalarExpr,
context_box: BoxId
) -> Result<BoxScalarExpr, QGMError>
fn generate_expr(
&mut self,
expr: HirScalarExpr,
context_box: BoxId
) -> Result<BoxScalarExpr, QGMError>
Lowers the given expression within the context of the given box.
Note that this method may add new quantifiers to the box for subquery expressions.
sourcefn generate_exprs(
&mut self,
exprs: Vec<HirScalarExpr>,
context_box: BoxId
) -> Result<Vec<BoxScalarExpr>, QGMError>
fn generate_exprs(
&mut self,
exprs: Vec<HirScalarExpr>,
context_box: BoxId
) -> Result<Vec<BoxScalarExpr>, QGMError>
Lowers the given expressions within the context of the given box.
Delegates to FromHir::generate_expr
for each element.
sourcefn find_column_within_box(
&self,
box_id: BoxId,
position: usize
) -> ColumnReference
fn find_column_within_box(
&self,
box_id: BoxId,
position: usize
) -> ColumnReference
Find the N-th column among the columns projected by the input quantifiers of the given box. This method translates Hir’s offset-based column into quantifier-based column references.
This method is equivalent to expr::JoinInputMapper::map_column_to_local
, in
the sense that given all the columns projected by a join (represented by the
set of input quantifiers of the given box) it returns the input the column
belongs to and its offset within the projection of the underlying operator.
sourcefn within_context<F, T>(&mut self, context_box: BoxId, f: &mut F) -> Twhere
F: FnMut(&mut Self) -> T,
fn within_context<F, T>(&mut self, context_box: BoxId, f: &mut F) -> Twhere
F: FnMut(&mut Self) -> T,
Executes the given action within the context of the given box.
sourcefn add_predicate(&mut self, box_id: BoxId, predicate: BoxScalarExpr)
fn add_predicate(&mut self, box_id: BoxId, predicate: BoxScalarExpr)
Adds the given predicate to the given box.
The given box must support predicates, ie. it must be either a Select box or an OuterJoin one.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FromHir
impl Send for FromHir
impl !Sync for FromHir
impl Unpin for FromHir
impl !UnwindSafe for FromHir
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
.