databend icon indicating copy to clipboard operation
databend copied to clipboard

Tabular SQL UDFs (UDTFs)

Open bohutang opened this issue 3 years ago • 5 comments

Summary

A user-defined table function can apply to a SQL query and returns 0, 1, or multi-rows, each result contains 1 or more columns. A snow style UDTFs:

create function sum_range_func(l int, r int)
  returns table (x integer)
  as 'select sum(a) from test where a > l and a < r'
  ;
  
select * from table(sum_range_func(1,9));

Reference: Databend scalar UDF: https://databend.rs/doc/reference/sql/ddl/udf/ddl-create-function Snowflake tabular UDF: https://docs.snowflake.com/en/developer-guide/udf/sql/udf-sql-tabular-functions.html

bohutang avatar Jun 02 '22 00:06 bohutang

/assignme

GrapeBaBa avatar Jun 02 '22 09:06 GrapeBaBa

@BohuTANG which parser should I use for this feature, v1 or v2?

GrapeBaBa avatar Jul 09 '22 12:07 GrapeBaBa

@BohuTANG which parser should I use for this feature, v1 or v2?

Please use v2, v2 will enabled by default soon.

bohutang avatar Jul 09 '22 12:07 bohutang

Hi @GrapeBaBa , How is this going or any questions?

bohutang avatar Jul 25 '22 01:07 bohutang

@BohuTANG I am busy in own job these two weeks. I can spend some time to do this task from this week, however if it is a high priority task, feel free to take it back.

GrapeBaBa avatar Jul 25 '22 01:07 GrapeBaBa