databend icon indicating copy to clipboard operation
databend copied to clipboard

feat: update supports external udf

Open bohutang opened this issue 1 year ago โ€ข 1 comments

Summary

CREATE OR REPLACE FUNCTION bendml_embed_text_768 (STRING)
    RETURNS ARRAY(FLOAT)
    LANGUAGE python
HANDLER = 'bendml_embed_text_768'
ADDRESS = 'https://api.bendml.com';

create or replace table doc(id INT, text STRING, embedding ARRAY(FLOAT) NULL);
insert into doc(id, text) values(1, 'ไปŠๅคฉๅคฉๆฐ”ๆ€Žไนˆๆ ท?'),(2, 'How is the weather today?');

update doc set embedding = bendml_embed_text_768(text) where embedding is NULL;

Error:

1065=>error: 
  --> SQL:2:28
  |
1 | 
2 | update doc set embedding = bendml_embed_text_768(text) where embedding is NULL;
  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ update_list in update statement can't contain subquery|window|aggregate|udf functions|async functions

bohutang avatar Jun 16 '24 11:06 bohutang

@zhyass Can we support udf functions in update? I suspect this isn't the same as subquery|windowsother cases.

bohutang avatar Jun 16 '24 11:06 bohutang