Questions tagged [user-defined-functions]

A function provided by the user of a program or an environment most often for spreadsheet type applications or database applications. Use [custom-functions-excel] for Excel and [custom-function] for Google sheets. Specify a programming language tag as well: [google-apps-script], [javascript], [sql], [tsql], etc. as well as a tag for the application: [excel], [google-spreadsheet], [sql-server] etc.

In the context of a programming language or an environment, a User Defined Function (UDF) is a function that is created by a user to perform a specific task (as opposed to a function that is intrinsic to the environment, built into the programming language or environment).

Spreadsheet applications like Excel and Google Sheets calls these "custom functions".

Microsoft also uses the term User Defined Functions with . The tag may also be applicable. See What is the need for user-defined functions in SQL Server?

Use:

4875 questions
1
vote
0 answers

Execute Python UDFs in a Java Dataflow Pipeline?

long time lurker, first time poster. I am currently trying to add execution of Python UDFs in a Java Dataflow pipeline. These UDFs would potentially employ third-party libraries and multiple modules. I have been reading a lot about Apache Beam…
1
vote
1 answer

AWS Glue Pyspark Python UDFRunner timing info total/boot/init/finish

I am running a Pyspark AWS Glue Job that includes a Python UDF. In the logs I see this line repeated. INFO [Executor task launch worker for task 15765] python.PythonUDFRunner (Logging.scala:logInfo(54)): Times: total = 268103, boot = 21, init =…
1
vote
2 answers

How to get the cell value from another worksheet and assign it to the return value of UDF?

Here is the little example of my two worksheets. Original Sheet: As you can see, this worksheet has two cells waiting to be recalculated at the later stage. (i.e. cells with red #Eval marker) Result Sheet: In the above Result sheet, we have got…
woodykiddy
  • 6,074
  • 16
  • 59
  • 100
1
vote
3 answers

Use of function calls in stored procedure sql server 2005?

Use of function calls in where clause of stored procedure slows down performance in sql server 2005? SELECT * FROM Member M WHERE LOWER(dbo.GetLookupDetailTitle(M.RoleId,'MemberRole')) != 'administrator' AND…
1
vote
1 answer

How do I return a datatype as a return object in scala

I want to return a datatype as a return value of a function in scala. I tried the below function. def typeGetterFun(`type`: DataType) = `type` match { case StringType => String case LongType => Long case IntegerType => Int …
1
vote
1 answer

How to get a variant/object out of a Java UDF in Snowflake? (in this case, while geocoding IP addresses)

This post has a class that can output a String with the geolocation of an address: https://hoffa.medium.com/free-ip-address-geolocation-with-maxmind-and-snowflake-676e74ea80b8 The relevant part is: public String x(String ip) throws Exception { …
1
vote
1 answer

Create a Java UDF that uses geoip2 library with the database in a S3 bucket

Correct me if i'm wrong, but my understanding of the UDF function in Snowpark is that you can send the function UDF from your IDE and it will be executed inside Snowflake. I have a staged database called GeoLite2-City.mmdb inside a S3 bucket on my…
1
vote
1 answer

What is the best way of including a UDF/CFC in a ColdFusion Model-Glue controller?

I have some common UDFs and CFCs that I'd like to make available to all my controllers. I'm using Model-Glue 3. I've thought of several ways of doing so: Create a base controller that has 's to the UDFs and instantiates the CFCs. All…
Daniel T.
  • 37,212
  • 36
  • 139
  • 206
1
vote
1 answer

Error when calling a user-defined function within a while loop, but not when called directly

When I call the user defined function sRGB_to_CAM16UCS in the console, it displays the result as intended. But when I try to call it within a while loop it throws an error. Can somebody help me understand the error? library(purrr)…
1
vote
2 answers

Prevent VBA UDF to get updated if row/col is inserted in excel worksheet

I have a function defined e.g. Public Function calc_x(ByVal x As Integer) ...do some stuff calc_x = x+x End Function This function gets called within the excel sheet from a cell lets say (A2), with a "pointer" to A1 which contains a value…
Bernd
  • 13
  • 4
1
vote
1 answer

Pyspark udf to get random value - returns constant

I am trying to populate a Spark column with random string values according to a list and probabilities. It seems a nested function is needed from what I have read. I am trying the below and it works EXCEPT it returns the same sampled value for every…
B_Miner
  • 1,840
  • 4
  • 31
  • 66
1
vote
1 answer

How to calculate rolling.agg('max') utilising a dataframe column as input to my function

I'm working with a kline dataframe. I'm adding a Swing_High and Swing_Low column to my df. I've picked up an error where during low volatile periods my Close == Swing_Low price. This gives me a inf error in another function I have where close /…
Stack
  • 13
  • 3
1
vote
2 answers

iTVF for splitting string into row of substrings based on a specified separator character breaks when received empty value (TSQL)

I have an inline table-valued function, which splits strings into row of substrings based on a specified separator. It is as follows: ALTER FUNCTION [dbo].[SplitString] (@List NVARCHAR(MAX), @Delim VARCHAR(255)) RETURNS TABLE AS RETURN…
1
vote
0 answers

UDF function fails in Spark 3.3.0

I have an application developed with Scala 2.11 and Spark 2.4 where and UDF is applied to a streaming dataframe to add a new column. Due to other library requirements, I have moved the application to Scala 2.12 and Spark 3.3 but now the code fails…
1
vote
1 answer

using grpc client shared library returns error undefined symbol stub::async

I am writing a gRPC code which is going to converted to .so file and using that shared library I am going to call the service from a mySQl UDF. This is my client.cc: #include #include #include…
sama
  • 333
  • 2
  • 11