Trait tidb_query_aggr::parser::AggrDefinitionParser [−][src]
Parse a specific aggregate function definition from protobuf.
All aggregate function implementations should include an impl for this trait as well as
add a match arm in map_pb_sig_to_aggr_func_parser
so that the aggregate function can be
actually utilized.
Required methods
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
Checks whether the inner expression of the aggregate function definition is supported.
It is ensured that aggr_def.tp
maps the current parser instance.
Provided methods
fn parse(
&self,
aggr_def: Expr,
ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
aggr_def: Expr,
ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
Parses and transforms the aggregate function definition.
The schema of this aggregate function will be appended in out_schema
and the final
RPN expression (maybe wrapped by some casting according to types) will be appended in
out_exp
.
The parser may choose particular aggregate function implementation based on the data
type, so schema
is also needed in case of data type depending on the column.
Panic
May panic if the aggregate function definition is not supported by this parser.
fn parse_rpn(
&self,
_root_expr: Expr,
_exp: RpnExpression,
_ctx: &mut EvalContext,
_src_schema: &[FieldType],
_out_schema: &mut Vec<FieldType>,
_out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
_root_expr: Expr,
_exp: RpnExpression,
_ctx: &mut EvalContext,
_src_schema: &[FieldType],
_out_schema: &mut Vec<FieldType>,
_out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
Implementors
impl AggrDefinitionParser for AggrFnDefinitionParserAvg
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
impl AggrDefinitionParser for AggrFnDefinitionParserCount
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
_src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
_src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
impl AggrDefinitionParser for AggrFnDefinitionParserFirst
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
impl AggrDefinitionParser for AggrFnDefinitionParserSum
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
impl AggrDefinitionParser for AllAggrDefinitionParser
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
Checks whether the aggregate function definition is supported.
fn parse(
&self,
aggr_def: Expr,
ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
aggr_def: Expr,
ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
Parses and transforms the aggregate function definition to generate corresponding
AggrFunction
instance.
Panic
May panic if the aggregate function definition is not supported.
impl<E: Extremum> AggrDefinitionParser for AggrFnDefinitionParserExtremum<E>
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
impl<T: BitOp> AggrDefinitionParser for AggrFnDefinitionParserBitOp<T>
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
impl<V: VarianceType> AggrDefinitionParser for AggrFnDefinitionParserVariance<V>
[src]
fn check_supported(&self, aggr_def: &Expr) -> Result<()>
[src]
fn parse_rpn(
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>
[src]
&self,
root_expr: Expr,
exp: RpnExpression,
_ctx: &mut EvalContext,
src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>
) -> Result<Box<dyn AggrFunction>>