Custom SQL function or UDF

Can we add a custom user defined function to dremio? I read the documentation but did not see any option to create my own function. Is this possible?

2 Likes

Hey Tim, thanks for bringing this up. This is one of the top items on our roadmap. I’ll reach out with more details as we plan and schedule this.

1 Like

Can, thank you. I am very excited about this product so feel free to share your roadmap with me if allowed.

1 Like

Hi Can, please update if UDF feature is now available or not?

Is it possible to create a custom UDF function in DremIO. For example i have one column which contains json string. I want to have a get_json_object type of UDF as in Hive. If not available i was thinking of can write one if there are interface specs or samples available.

There’s a lot of support for JSON in Dremio without resorting to UDFs. For example, you can use . to access children, and the FLATTEN() operator to handle arrays:

https://docs.dremio.com/sql-reference/sql-functions/nested-data.html

What is particular are you trying to do with JSON?

hey @sambitdixit, how about something like the following:

SELECT convert_from('{"a":1,"b":["x","y","z"]}', 'JSON') AS field
FROM (values 1)

You can then access individual items as follows:

field.a --would return 1
field.b[0] --would return "x"
FLATTEN(field.b) --would return a new row for each item in b

Thanks can & kelly . This is useful.

Hey team,
Did we enable the support of UDFs in Dremio or is it still in the roadmap?

It would be great if someone can help on this use case

Thanks,
Jalandhar

https://github.com/dremio-hub/dremio-internal-function-example may be helpful