61 if (args->arg_count < 1 || args->arg_count > 2) {
62 strcpy(message,
"skewness_coor() requires one or two arguments");
65 args->arg_type[0] = REAL_RESULT;
66 if (args->arg_count > 1) {
67 args->arg_type[1] = REAL_RESULT;
72 strcpy(message,
"Couldn't allocate memory");
75 data->
argc = args->arg_count;
77 initid->maybe_null = 1;
79 initid->max_length = 13 + initid->decimals;
80 initid->ptr = (
char *) data;
81 initid->const_item = 0;
135 if (!args->args[0]) {
139 if (data->
argc > 1) {
140 if (!args->args[1]) {
143 w = *((
double*) args->args[1]);
147 x = *((
double*) args->args[0]);
151 data->
sumXX += w * x*x;
152 data->
sumXXX += w * x*x*x;
164 double skewness_samp(UDF_INIT *initid, UDF_ARGS *args,
char *is_null,
char *error) {
174 if (data->
count <= 2) {
189 ret = sqrt(data->
count * (data->
count - 1) ) / (data->
count - 2) * m3 / sqrt(m2 * m2 * m2);
void skewness_samp_clear(UDF_INIT *initid, char *is_null, char *error)
Called at start of group.
Definition of functions for UDFs and plugins.
#define NOT_FIXED_DEC
Maximum number of digits in double As defined in mysql/sql_string.h.
int argc
number of arguments
Storage for sample moment coefficient of skewness.
void skewness_samp_reset(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Reset function and add first group member Calls clear and add.
void skewness_samp_deinit(UDF_INIT *initid)
Called after last access to function.
my_bool skewness_samp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
Called before first usage of function.
void skewness_samp_add(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Add a member of the group.
double skewness_samp(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
Retrieve sample moment coefficient of skewness. Called at end of group.