risinglightdb / risinglight

An educational OLAP database system.
Apache License 2.0
1.59k stars 211 forks source link

feat(sql-udf): add support for named sql udf #829

Closed xzhseh closed 6 months ago

xzhseh commented 7 months ago

We now support named sql udf in risinglight!

e.g., the following definitions are totally valid and could be used as normal built-in functions now.

create function add_named(a INT, b INT) returns int language sql as 'select a + b';
create function sub_named(a INT, b INT) returns int language sql as 'select a - b';

See the test cases for detailed use cases.

P.S. anonymous sql udf may be supported in subsequent PRs, with other necessary preparations.

cc @wangrunji0408.

xzhseh commented 7 months ago

LGTM. But I prefer to complete a minimal workable SQL UDF in a single PR. This way we can revisit the whole design and see where can be optimized or simplified. 🤔

For sure, I'll add named sql udf support in this PR later. (anonymous sql udf support in the future)