Snowflake UDF #355
Replies: 5 comments 10 replies
-
At this point I hadn't thought of adding this because I didn't know about this system. Now since this library does use ~200MiB of RAM I'm curious to see if this is allowed; this page is not clear to me on this subject: https://docs.snowflake.com/en/developer-guide/udf/java/udf-java-designing.html#label-udf-java-limitations I'll have a look at the documentation |
Beta Was this translation helpful? Give feedback.
-
Looking at this documentation https://docs.snowflake.com/en/developer-guide/udf/java/udf-java-creating.html#label-udf-java-in-line-examples the "inline" java UDF may be a simply quick way for you to use it? I do not have any way of testing this (so this WILL have mistakes I cannot verify) but it seems that something like this may work:
I would really appreciate it if you can verify this. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response! I didn't think this would work because your UserAgentAnalyzer is not a part of core java, but I wanted to try it out anyway. Here was the full error message that I received:
When I have some more time next week, I'll see if I can compile my own version of the in-line code that you gave me to use as a pre-compiled UDF. Also, I don't think memory should be an issue - I'm assuming that Snowflake is giving an extremely basic example here for documentation purposes, but we shall see! |
Beta Was this translation helpful? Give feedback.
-
Hi Niels, Decided to go ahead and give this a try this evening and I was able to get this working! It took some tinkering with maven (I'm not a Java developer), but because Snowflake forces you to pre-compile everything and upload as 1 jar, I did the following steps:
The only other minor thing is that Snowflake is actually going to return an object instead of a variant.
I'll need to do some actual load testing, but the 2-3 seconds of compute seem in-line with what you've mentioned in your documentation. Thanks very much for the help here - I really appreciate it! |
Beta Was this translation helpful? Give feedback.
-
A did a first attempt to build this at my end. The code is in a separate branch SnowflakeUDF You can download the binary here: |
Beta Was this translation helpful? Give feedback.
-
Hi Niels,
Any plans on creating a Snowflake UDF? https://docs.snowflake.com/en/developer-guide/udf/java/udf-java.html
If not, that's okay, I might try it myself soon. If you were already planning on it, then I didn't want to duplicate efforts.
Thanks,
Luke
Beta Was this translation helpful? Give feedback.
All reactions