Struct mentat_query_projector::CombinedProjection
[−]
[src]
pub struct CombinedProjection { pub sql_projection: Projection, pub pre_aggregate_projection: Option<Projection>, pub datalog_projector: Box<Projector>, pub distinct: bool, pub group_by_cols: Vec<GroupBy>, }
Combines the things you need to turn a query into SQL and turn its results into
QueryResults
: SQL-related projection information (DISTINCT
, columns, etc.) and
a Datalog projector that turns SQL into structures.
Fields
sql_projection: Projection
A SQL projection, mapping columns mentioned in the body of the query to columns in the output.
pre_aggregate_projection: Option<Projection>
If a query contains aggregates, we need to generate a nested subquery: an inner query
that returns our distinct variable bindings (and any :with
vars), and an outer query
that applies aggregation. That's so we can put DISTINCT
in the inner query and apply
aggregation afterwards -- SELECT DISTINCT count(foo)
counts then uniques, and we need
the opposite to implement Datalog distinct semantics.
If this is the case, sql_projection
will be the outer query's projection list, and
pre_aggregate_projection
will be the inner.
If the query doesn't use aggregation, this field will be None
.
datalog_projector: Box<Projector>
A Datalog projection. This consumes rows of the appropriate shape (as defined by the SQL projection) to yield one of the four kinds of Datalog query result.
distinct: bool
True if this query requires the SQL query to include DISTINCT.
group_by_cols: Vec<GroupBy>
Trait Implementations
Auto Trait Implementations
impl !Send for CombinedProjection
impl !Send for CombinedProjection
impl !Sync for CombinedProjection
impl !Sync for CombinedProjection