pub struct AggregationSqlGenerator { /* private fields */ }Expand description
Aggregation SQL generator
Implementations§
Source§impl AggregationSqlGenerator
impl AggregationSqlGenerator
Sourcepub fn generate_partial_period(
&self,
plan: &AggregationPlan,
config: &PartialPeriodConfig,
branch_plan: &BranchPlan,
extra_where: Option<&WhereClause>,
) -> Result<PartialPeriodSql>
pub fn generate_partial_period( &self, plan: &AggregationPlan, config: &PartialPeriodConfig, branch_plan: &BranchPlan, extra_where: Option<&WhereClause>, ) -> Result<PartialPeriodSql>
Generates a UNION ALL query for partial-period aggregation.
Combines fine-grain and coarse-grain branches according to the BranchPlan.
Each branch gets the same SELECT columns and aggregate expressions, but
fine-grain branches apply DATE_TRUNC to the time-grain column while coarse
branches use it directly.
§Errors
Returns error if SQL expression generation fails.
Source§impl AggregationSqlGenerator
impl AggregationSqlGenerator
Sourcepub fn build_where_clause_parameterized(
&self,
where_clause: &WhereClause,
metadata: &FactTableMetadata,
params: &mut Vec<Value>,
) -> Result<String>
pub fn build_where_clause_parameterized( &self, where_clause: &WhereClause, metadata: &FactTableMetadata, params: &mut Vec<Value>, ) -> Result<String>
Build a parameterized WHERE … clause, or an empty string if the clause is empty.
§Errors
Returns an error if WHERE clause generation fails.
Source§impl AggregationSqlGenerator
impl AggregationSqlGenerator
Sourcepub const fn new(database_type: DatabaseType) -> Self
pub const fn new(database_type: DatabaseType) -> Self
Create new SQL generator for specific database
Sourcepub fn generate_parameterized(
&self,
plan: &AggregationPlan,
) -> Result<ParameterizedAggregationSql>
pub fn generate_parameterized( &self, plan: &AggregationPlan, ) -> Result<ParameterizedAggregationSql>
Generate a parameterized aggregate SQL query.
All user-supplied string values in WHERE and HAVING clauses are emitted as
bind placeholders ($N / ? / @P1 depending on the database dialect) rather
than being embedded as escaped string literals. Numeric, boolean, and NULL
values are still inlined since they carry no injection risk.
§Errors
Returns error if SQL generation fails (unknown aggregate function, etc.).