summaryrefslogtreecommitdiff
path: root/sql/sql_udf.h
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-11-20 10:58:34 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2018-11-27 14:33:39 +0100
commit555921a9c3ddcd638e7f08ea117738640e300875 (patch)
treee6cbc156d1fc1424f1d2356810e3a82604167199 /sql/sql_udf.h
parenta956260d826650f0a35779621c5987dc30f7ba04 (diff)
downloadmariadb-git-555921a9c3ddcd638e7f08ea117738640e300875.tar.gz
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
Diffstat (limited to 'sql/sql_udf.h')
-rw-r--r--sql/sql_udf.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index 6e6fed2a81a..4fa75759269 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -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);
};