59 if (args->arg_count < 1 || args->arg_count > 2) {
60 strcpy(message,
"stddevw_pop() requires one or two arguments");
63 args->arg_type[0] = REAL_RESULT;
64 if (args->arg_count > 1) {
65 args->arg_type[1] = REAL_RESULT;
70 strcpy(message,
"Couldn't allocate memory");
73 data->
argc = args->arg_count;
75 initid->maybe_null = 1;
77 initid->max_length = 13 + initid->decimals;
78 initid->ptr = (
char *) data;
79 initid->const_item = 0;
132 if (!args->args[0]) {
136 if (data->
argc > 1) {
137 if (!args->args[1]) {
140 w = *((
double*) args->args[1]);
144 x = *((
double*) args->args[0]);
148 data->
sumXX += w * x * x;
160 double stddevw_pop(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
169 if (data->
count <= 0) {
Definition of functions for UDFs and plugins.
Storage for weighted standard deviation of population.
#define NOT_FIXED_DEC
Maximum number of digits in double As defined in mysql/sql_string.h.
int argc
number of arguments
void stddevw_pop_clear(UDF_INIT *initid, char *is_null, char *error)
Called at start of group.
void stddevw_pop_reset(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Reset function and add first group member Calls clear and add.
void stddevw_pop_add(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Add a member of the group.
void stddevw_pop_deinit(UDF_INIT *initid)
Called after last access to function.
my_bool stddevw_pop_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
Called before first usage of function.
double stddevw_pop(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Retrieve weighted standard deviation of population. Called at end of group.