MySQL 8.0.39
Source Code Documentation
Aggregator Class Referenceabstract

The abstract base class for the Aggregator_* classes. More...

#include <item_sum.h>

Inheritance diagram for Aggregator:
[legend]

Public Types

enum  Aggregator_type { SIMPLE_AGGREGATOR , DISTINCT_AGGREGATOR }
 

Public Member Functions

 Aggregator (Item_sum *arg)
 
virtual ~Aggregator ()=default
 
virtual Aggregator_type Aggrtype ()=0
 
virtual bool setup (THD *)=0
 Called before adding the first row. More...
 
virtual void clear ()=0
 Called when we need to wipe out all the data from the aggregator: all the values accumulated and all the state. More...
 
virtual bool add ()=0
 Called when there's a new value to be aggregated. More...
 
virtual void endup ()=0
 Called when there are no more data and the final value is to be retrieved. More...
 
virtual my_decimalarg_val_decimal (my_decimal *value)=0
 Decimal value of being-aggregated argument. More...
 
virtual double arg_val_real ()=0
 Floating point value of being-aggregated argument. More...
 
virtual bool arg_is_null (bool use_null_value)=0
 NULLness of being-aggregated argument. More...
 

Protected Attributes

Item_sumitem_sum
 

Friends

class Item_sum
 
class Item_sum_sum
 
class Item_sum_count
 
class Item_sum_avg
 

Detailed Description

The abstract base class for the Aggregator_* classes.

It implements the data collection functions (setup/add/clear) as either pass-through to the real functionality or as collectors into an Unique (for distinct) structure.

Note that update_field/reset_field are not in that class, because they're simply not called when GROUP BY/DISTINCT can be handled with help of index on grouped fields (allow_group_via_temp_table is false);

Member Enumeration Documentation

◆ Aggregator_type

Enumerator
SIMPLE_AGGREGATOR 
DISTINCT_AGGREGATOR 

Constructor & Destructor Documentation

◆ Aggregator()

Aggregator::Aggregator ( Item_sum arg)
inline

◆ ~Aggregator()

virtual Aggregator::~Aggregator ( )
virtualdefault

Member Function Documentation

◆ add()

virtual bool Aggregator::add ( )
pure virtual

Called when there's a new value to be aggregated.

Updates the internal state of the aggregator to reflect the new value.

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ Aggrtype()

virtual Aggregator_type Aggregator::Aggrtype ( )
pure virtual

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ arg_is_null()

virtual bool Aggregator::arg_is_null ( bool  use_null_value)
pure virtual

NULLness of being-aggregated argument.

Parameters
use_null_valueOptimization: to determine if the argument is NULL we must, in the general case, call is_null() on it, which itself might call val_*() on it, which might be costly. If you just have called arg_val*(), you can pass use_null_value=true; this way, arg_is_null() might avoid is_null() and instead do a cheap read of the Item's null_value (updated by arg_val*()).

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ arg_val_decimal()

virtual my_decimal * Aggregator::arg_val_decimal ( my_decimal value)
pure virtual

Decimal value of being-aggregated argument.

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ arg_val_real()

virtual double Aggregator::arg_val_real ( )
pure virtual

Floating point value of being-aggregated argument.

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ clear()

virtual void Aggregator::clear ( )
pure virtual

Called when we need to wipe out all the data from the aggregator: all the values accumulated and all the state.

Cleans up the internal structures and resets them to their initial state.

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ endup()

virtual void Aggregator::endup ( )
pure virtual

Called when there are no more data and the final value is to be retrieved.

Finalises the state of the aggregator, so the final result can be retrieved.

Implemented in Aggregator_distinct, and Aggregator_simple.

◆ setup()

virtual bool Aggregator::setup ( THD )
pure virtual

Called before adding the first row.

Allocates and sets up the internal aggregation structures used, e.g. the Unique instance used to calculate distinct.

Implemented in Aggregator_distinct, and Aggregator_simple.

Friends And Related Function Documentation

◆ Item_sum

friend class Item_sum
friend

◆ Item_sum_avg

friend class Item_sum_avg
friend

◆ Item_sum_count

friend class Item_sum_count
friend

◆ Item_sum_sum

friend class Item_sum_sum
friend

Member Data Documentation

◆ item_sum

Item_sum* Aggregator::item_sum
protected

The documentation for this class was generated from the following file: