Listagg function is not working in UDF

Hi,

I’m trying to create a user-defined function (UDF) in Dremio to replicate the functionality of the PostgreSQL function regexp_split_to_array. The UDF involves using the listagg function for string aggregation. When I run the SQL query alone, it works perfectly fine. However, when I create a function with the same logic and try to use it, Dremio raises an error indicating that it cannot find the ‘listagg’ function.

I would like to know if the ‘listagg’ function is supported in Dremio and if there is any alternative approach to achieve string aggregation in a UDF. Additionally, if there are any specific considerations or configurations needed to enable the ‘listagg’ function or replicate the functionality of regexp_split_to_array in Dremio, I would greatly appreciate the guidance.

Example Query : SELECT CONCAT(‘{’,LISTAGG(CONCAT(‘“’,
FLATTEN(REGEXP_SPLIT(‘the quick brown fox jumps over the lazy dog’, ‘\s+’, ‘ALL’,
1000000000)),‘”’), ‘,’),‘}’)

Thank you for your assistance!

Sounds similar to another recent post. See if my response over there helps.