add udf.sql script to create aggregate functions