MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Aggregator Class Reference

#include <item_sum.h>

Inheritance diagram for Aggregator:
Collaboration diagram for Aggregator:

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_decimalarg_val_decimal (my_decimal *value)=0
virtual double arg_val_real ()=0
virtual bool arg_is_null ()=0

Protected Attributes

Item_sumitem_sum
bool use_distinct_values

Friends

class Item_sum
class Item_sum_sum
class Item_sum_count
class Item_sum_avg

Additional Inherited Members

- Static Public Member Functions inherited from Sql_alloc
static void * operator new (size_t size) throw ()
static void * operator new[] (size_t size) throw ()
static void * operator new[] (size_t size, MEM_ROOT *mem_root) throw ()
static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, size_t size)
static void operator delete (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, size_t size)

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 (quick_group = 0);

Definition at line 42 of file item_sum.h.

Member Function Documentation

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.

Here is the caller graph for this function:

virtual bool Aggregator::arg_is_null ( )
pure virtual

NULLness of being-aggregated argument; can be called only after arg_val_decimal() or arg_val_real().

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.

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

Member Data Documentation

bool Aggregator::use_distinct_values
protected

When feeding back the data in endup() from Unique/temp table back to Item_sum::add() methods we must read the data from Unique (and not recalculate the functions that are given as arguments to the aggregate function. This flag is to tell the add() methods to take the data from the Unique instead by calling the relevant val_..() method

Definition at line 66 of file item_sum.h.


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