MySQL 5.6.14 Source Code Document
|
#include <item_sum.h>
Public Member Functions | |
Aggregator_distinct (Item_sum *sum) | |
Aggregator_type | Aggrtype () |
bool | setup (THD *) |
void | clear () |
bool | add () |
void | endup () |
virtual my_decimal * | arg_val_decimal (my_decimal *value) |
virtual double | arg_val_real () |
virtual bool | arg_is_null () |
bool | unique_walk_function (void *element) |
Public Member Functions inherited from Aggregator | |
Aggregator (Item_sum *arg) |
Static Public Member Functions | |
static int | composite_key_cmp (void *arg, uchar *key1, uchar *key2) |
Friends | |
class | Item_sum_sum |
Additional Inherited Members | |
Public Types inherited from Aggregator | |
enum | Aggregator_type { SIMPLE_AGGREGATOR, DISTINCT_AGGREGATOR } |
Protected Attributes inherited from Aggregator | |
Item_sum * | item_sum |
bool | use_distinct_values |
The distinct aggregator. Implements AGGFN (DISTINCT ..) Collects all the data into an Unique (similarly to what Item_sum_distinct does currently) and then (if applicable) iterates over the list of unique values and pumps them back into its object
Definition at line 541 of file item_sum.h.
|
virtual |
Process incoming row.
Add it to Unique/temp hash table if it's unique. Skip the row if not unique. Prepare Aggregator_distinct to process the incoming stream. Create the temporary table and the Unique class if needed. Called by Item_sum::aggregator_add(). To actually get the result value in item_sum's buffers Aggregator_distinct::endup() must be called.
FALSE | success |
TRUE | failure |
Implements Aggregator.
Definition at line 1006 of file item_sum.cc.
|
virtual |
NULLness of being-aggregated argument; can be called only after arg_val_decimal() or arg_val_real().
Implements Aggregator.
Definition at line 1520 of file item_sum.cc.
|
virtual |
Decimal value of being-aggregated argument
Implements Aggregator.
Definition at line 1506 of file item_sum.cc.
|
virtual |
Floating point value of being-aggregated argument
Implements Aggregator.
Definition at line 1513 of file item_sum.cc.
|
virtual |
Invalidate calculated value and clear the distinct rows.
Frees space used by the internal data structures. Removes the accumulated distinct rows. Invalidates the calculated result.
Implements Aggregator.
Definition at line 966 of file item_sum.cc.
|
static |
Correctly compare composite keys.
Used by the Unique class to compare keys. Will do correct comparisons for composite keys with various field types.
arg | Pointer to the relevant Aggregator_distinct instance |
key1 | left key image |
key2 | right key image |
<0 | if key1 < key2 |
=0 | if key1 = key2 |
>0 | if key1 > key2 |
Definition at line 682 of file item_sum.cc.
|
virtual |
Calculate the aggregate function value.
Since Distinct_aggregator::add() just collects the distinct rows, we must go over the distinct rows and feed them to the aggregation function before returning its value. This is what endup () does. It also sets the result validity flag endup_done to TRUE so it will not recalculate the aggregate value again if the Item_sum hasn't been reset.
Implements Aggregator.
Definition at line 1065 of file item_sum.cc.
|
virtual |
Called before feeding the first row. Used to allocate/setup the internal structures used for aggregation.
thd | Thread descriptor |
FALSE | success |
TRUE | faliure |
Prepares Aggregator_distinct to process the incoming stream. Creates the temporary table and the Unique class if needed. Called by Item_sum::aggregator_setup()
Implements Aggregator.
Definition at line 764 of file item_sum.cc.
bool Aggregator_distinct::unique_walk_function | ( | void * | element | ) |
Aggregate a distinct row from the distinct hash table.
Called for each row into the hash table 'Aggregator_distinct::table'. Includes the current distinct row into the calculation of the aggregate value. Uses the Field classes to get the value from the row. This function is used for AVG/SUM(DISTINCT). For COUNT(DISTINCT) it's called only when there are no blob arguments and the data don't fit into memory (so Unique makes persisted trees on disk).
element | pointer to the row data. |
FALSE | success |
TRUE | failure |
Definition at line 1460 of file item_sum.cc.