How to upload UDF on TG cloud instance?

I am trying to run k_means algorithm on dataset for which I copied tg_kmeans and tg_kmeans_sub queries from tigergraph’s github to my tgcloud (free cluster). I am getting error related to function rand_int in tg_kmeans_sub as this function is undefined.
I need to put ExprFunctions.hpp to tgcloud cluster but unable to do it, found this link as well : deploy custom udf to tgcloud instance
The solution mentioned here didn’t work. When unzipped ExportedGraph, there was no such file named ExprFunctions.hpp. Contents of ExportedGraph folder:

How can I upload correct ExprFunctions.hpp on tgcloud free instance?

Hi, Nagarro.

Thanks for reaching out to the TigerGraph forum. Currently, you need to ask TSE for support when uploading the customized UDF files. Please raise a ticket at Zendesk and you will get support from there.

Best regards,
Ryan Wang

1 Like

Hi, @mt_nagarro
This is a great question. As of now, there isn’t a “best way”. There is a way.

  1. You need to export your solution
  2. Unzip the tar file
  3. Unzip template > ExportedGraph
  4. Make edits directly to ExprFunctions.hpp

Query UDFs should be defined in C++ in the ExprFunctions.hpp file located at <tigergraph.root.dir>/app/<VERSION_NUM>/dev/gdk/gsql/src/QueryUdf/ . Replace <VERSION_NUM> with the version number of the TigerGraph instance running on your machine https://docs.tigergraph.com/dev/gsql-ref/querying/operators-functions-and-expressions#query-user-defined-functions

  1. Zip up ExportedGraph
  2. tar your full solution
  3. Import Existing Solution back

Thanks @ryanwang for your replies. I’ve raised a ticket on Zendesk.

Since I already tried exporting the solution and unzipping ExportedGraph but couldn’t find ExprFunctions.hpp, this solution doesn’t seem to be working.