matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.71k stars 267 forks source link

[Feature Request]: Support user defined functions #6581

Open domingozhang opened 1 year ago

domingozhang commented 1 year ago

Is there an existing issue for the same feature request?

Is your feature request related to a problem?

No response

Describe the feature you'd like

CREATE FUNCTION [IF NOT EXISTS] func_name ([func_parameter[,...]]) RETURNS type routine_body

func_parameter: param_name type

type: Any valid MO data type

routine_body: Valid SQL routine statement

DROP FUNCTION [IF EXISTS] f func_name();

Describe implementation you've considered

Update in 2024.01.15

The objective of this feature for 1.2 milestone is to gets a Python Machine Learning demo running. Anythings blocks this objective will be considered as feature or bug of UDF.

Documentation, Adoption, Use Case, Migration Strategy

No response

Additional information

No response

fengttt commented 1 year ago

Simple SQL UDF can simply be crafted into tree.

domingozhang commented 1 year ago

Regarding simple SQL UDF in 0.7, I suggest these features list, please review @fengttt

aressu1985 commented 1 year ago

@domingozhang what about operators for data type? such as +/-/*/ to numeric type, and functions like sub_str to String type?

domingozhang commented 1 year ago

I suggest we support expressions as input parameters in 0.7.0

fengttt commented 1 year ago
  1. variable and flow control structure is not part of sql udf. won't do. we will only support expression, but completely, any expression.
  2. if user really need that, they should write python udf.
fengttt commented 11 months ago

UDF transfered to @aylei