My Project
|
#include <item_sum.h>
Public Types | |
enum | Aggregator_type { SIMPLE_AGGREGATOR, DISTINCT_AGGREGATOR } |
Public Member Functions | |
Aggregator (Item_sum *arg) | |
virtual Aggregator_type | Aggrtype ()=0 |
virtual bool | setup (THD *)=0 |
virtual void | clear ()=0 |
virtual bool | add ()=0 |
virtual void | endup ()=0 |
virtual my_decimal * | arg_val_decimal (my_decimal *value)=0 |
virtual double | arg_val_real ()=0 |
virtual bool | arg_is_null (bool use_null_value)=0 |
Protected Attributes | |
Item_sum * | item_sum |
Friends | |
class | Item_sum |
class | Item_sum_sum |
class | Item_sum_count |
class | Item_sum_avg |
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 (quick_group = 0);
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_simple, and Aggregator_distinct.
virtual bool Aggregator::arg_is_null | ( | bool | use_null_value | ) | [pure virtual] |
NULLness of being-aggregated argument.
use_null_value | Optimization: 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_simple, and Aggregator_distinct.
virtual my_decimal* Aggregator::arg_val_decimal | ( | my_decimal * | value | ) | [pure virtual] |
Decimal value of being-aggregated argument
Implemented in Aggregator_simple, and Aggregator_distinct.
virtual double Aggregator::arg_val_real | ( | ) | [pure virtual] |
Floating point value of being-aggregated argument
Implemented in Aggregator_simple, and Aggregator_distinct.
virtual void Aggregator::clear | ( | ) | [pure virtual] |
Called when we need to wipe out all the data from the aggregator : all the values acumulated and all the state. Cleans up the internal structures and resets them to their initial state.
Implemented in Aggregator_simple, and Aggregator_distinct.
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_simple, and Aggregator_distinct.
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_simple, and Aggregator_distinct.