Struct sql::query_model::Model [−][src]
pub struct Model {
pub(crate) top_box: BoxId,
boxes: HashMap<BoxId, Box<RefCell<QueryBox>>>,
box_id_gen: Gen<BoxId>,
quantifiers: HashMap<QuantifierId, Box<RefCell<Quantifier>>>,
quantifier_id_gen: Gen<QuantifierId>,
}
Expand description
A Query Graph Model instance represents a SQL query. See the design doc for details.
In this representation, SQL queries are represented as a graph of operators, represented as boxes, that are connected via quantifiers. A top-level box represents the entry point of the query.
Each non-leaf box has a set of quantifiers, which are the inputs of the operation it represents. The quantifier adds information about how the relation represented by its input box is consumed by the parent box.
Fields
top_box: BoxId
The ID of the box representing the entry-point of the query.
boxes: HashMap<BoxId, Box<RefCell<QueryBox>>>
All boxes in the query graph model.
box_id_gen: Gen<BoxId>
Used for assigning unique IDs to query boxes.
quantifiers: HashMap<QuantifierId, Box<RefCell<Quantifier>>>
All quantifiers in the query graph model.
quantifier_id_gen: Gen<QuantifierId>
Used for assigning unique IDs to quantifiers.
Implementations
Get an immutable reference to the box identified by box_id
bound to this Model
.
Get a mutable reference to the box identified by box_id
bound to this Model
.
pub(crate) fn make_quantifier(
&mut self,
quantifier_type: QuantifierType,
input_box: BoxId,
parent_box: BoxId
) -> QuantifierId
pub(crate) fn make_quantifier(
&mut self,
quantifier_type: QuantifierType,
input_box: BoxId,
parent_box: BoxId
) -> QuantifierId
Create a new quantifier and adds it to the parent box
Get an immutable reference to the box identified by box_id
bound to this Model
.
pub(crate) fn get_mut_quantifier(
&mut self,
quantifier_id: QuantifierId
) -> BoundRefMut<'_, Quantifier>
pub(crate) fn get_mut_quantifier(
&mut self,
quantifier_id: QuantifierId
) -> BoundRefMut<'_, Quantifier>
Get a mutable reference to the box identified by box_id
bound to this Model
.
Same as Model::try_visit_pre_post
, but permits mutating the model.
Same as Model::try_visit_pre_post_descendants
, but permits mutating the model.
Removes unreferenced objects from the model.
May be invoked several times during query rewrites.
Renumbers all the boxes and quantifiers in the model starting from 0.
Intended to be called after Model::garbage_collect.
Renumbering the model does not save memory or improve the performance of traversing the model, but it does make the Dot graph easier to parse.
Validate a model with a default validator chain.
Trait Implementations
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for Model
impl !UnwindSafe for Model
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more