60 if (args->arg_count < 1 || args->arg_count > 2) {
61 strcpy(message,
"skewness_pop() requires one or two arguments");
64 args->arg_type[0] = REAL_RESULT;
65 if (args->arg_count > 1) {
66 args->arg_type[1] = REAL_RESULT;
71 strcpy(message,
"Couldn't allocate memory");
74 data->
argc = args->arg_count;
76 initid->maybe_null = 1;
78 initid->max_length = 13 + initid->decimals;
79 initid->ptr = (
char *) data;
80 initid->const_item = 0;
134 if (!args->args[0]) {
138 if (data->
argc > 1) {
139 if (!args->args[1]) {
142 w = *((
double*) args->args[1]);
146 x = *((
double*) args->args[0]);
150 data->
sumXX += w * x*x;
151 data->
sumXXX += w * x*x*x;
163 double skewness_pop(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
173 if (data->
count <= 0) {
188 ret = m3 / sqrt(m2 * m2 * m2);
Definition of functions for UDFs and plugins.
int argc
number of arguments
my_bool skewness_pop_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
Called before first usage of function.
void skewness_pop_add(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Add a member of the group.
#define NOT_FIXED_DEC
Maximum number of digits in double As defined in mysql/sql_string.h.
void skewness_pop_deinit(UDF_INIT *initid)
Called after last access to function.
void skewness_pop_clear(UDF_INIT *initid, char *is_null, char *error)
Called at start of group.
Storage for population moment coefficient of skewness.
double skewness_pop(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Retrieve population moment coefficient of skewness. Called at end of group.
void skewness_pop_reset(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Reset function and add first group member Calls clear and add.