1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-15073: Generic UDAF parser code in server for windows functions

Added support for usual agreggate UDF (UDAF)
Added remove() call support for more efficient window function processing
Added example of aggregate UDF with efficient windows function support
This commit is contained in:
Oleksandr Byelkin
2018-11-20 10:58:34 +01:00
parent a956260d82
commit 555921a9c3
10 changed files with 386 additions and 0 deletions

View File

@ -47,6 +47,7 @@ typedef struct st_udf_func
Udf_func_deinit func_deinit;
Udf_func_clear func_clear;
Udf_func_add func_add;
Udf_func_add func_remove;
ulong usage_count;
} udf_func;
@ -131,6 +132,20 @@ class udf_handler :public Sql_alloc
func(&initid, &f_args, &is_null, &error);
*null_value= (my_bool) (is_null || error);
}
bool supports_removal() const
{ return MY_TEST(u_d->func_remove); }
void remove(my_bool *null_value)
{
DBUG_ASSERT(u_d->func_remove);
if (get_arguments())
{
*null_value=1;
return;
}
Udf_func_add func= u_d->func_remove;
func(&initid, &f_args, &is_null, &error);
*null_value= (my_bool) (is_null || error);
}
String *val_str(String *str,String *save_str);
};