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
2 answers

Excel VBA: UDF results in #NAME? error when called from cell

I copied some UDF function code that serves my purpose from this guide which supposedly has worked for others. I didn't really alter the code much, but for transparency here is the exact code I have in my workbook as a module: Function…
1
vote
3 answers

ColdFusion User Defined Functions from included file aren't available

I am using ColdFusion 9. I am including a UDF library (UDF_Library.cfm) that has just a few functions it in. When I try to access the functions, I get an error that says "Variable POPUP is undefined". The library is included in the Application.cfc…
Evik James
  • 10,335
  • 18
  • 71
  • 122
1
vote
0 answers

Issues defining an Aggregator with case class input

I'm trying to define a custom aggregation function which takes a StructType field as an input, using the Aggregator API with Dataframes. Spark version is 3.1.2. Here's a reduced example (basic one-field case class, being passed in as a Row and…
1
vote
1 answer

How to check whether a value is present in a vector with a UDF and for loop

The goal is to create a function that will test to see if a number is in a vector. For example, you would call it like this: function_name(3,c(1,2,3)) and it would return TRUE since 3 is one of the elements in the function. My function works when…
1
vote
0 answers

Pyspark / Databricks. Kolmogorov - Smirnov over time. Efficiently. In parallel

Hello StackOverflowers. I have a pyspark dataframe that consists of a time_column and a column with values. E.g. +----------+--------------------+ | snapshot| values| +----------+--------------------+ |2005-01-31|…
1
vote
3 answers

When are classes better to use than user-defined functions in python?

I am learning classes in python, and I have two methods of webscraping a website -namely, the functions gets the urls to paginate through. One way is written via a class Method and the other is just a straight up function. I am confused, they are…
Josh
  • 43
  • 1
  • 7
1
vote
2 answers

Clear argument descriptions of UDF using MacroOptions method

I used MacroOptions method to add descriptions for UDF. How to clear/unregister UDF descriptions? This code works: Application.MacroOptions Macro:=Fname, Description:=Empty, Category:=Empty But this codes doesn't work: Application.MacroOptions…
AliM67
  • 123
  • 12
1
vote
1 answer

GCP Dataflow UDF import files

I'm using the PubSub to Elastic Dataflow template and I need to do some enrichment, like XML parsing. I have two issues: Can I split my code into many files and import them using UDF and how? Can I install external libraries? I read only plain js…
llermaly
  • 2,331
  • 2
  • 16
  • 29
1
vote
2 answers

Why Hive errors FileNotFoundException when a UDF use some external resource files but runs right at native?

A UDF used some external resource files, then it error: "java.io.FileNotFoundException: resource/placeMap.txt (No such file or directory)", this function runs right at native, why wrong at hive, how can I solved it ? Thank you very much!
Suge
  • 2,808
  • 3
  • 48
  • 79
1
vote
0 answers

Bigquery UDF bq data move to memorystore by customizable query

I would like to create a bigquery udf to transport the data from bigquery to memorystore. To do this I think I should follow 3 steps: def get_column_from_table(keys) .... I should bring my main key here from bigquery def get_field_value(field,…
1
vote
1 answer

How to get Jaccard similarity between two array columns in a table in Snowflake

I'm basing my question is this previous one, that missed sample data and desired results: How to perform Jaccard similarity between two array columns in a table in Snowflake I want to write a UDF in Snowflake that can compute Jaccard similarity…
1
vote
1 answer

User Defined Function on a column of DataFrame

I am trying to run a user defined function (udf) for every row in collect_list_relevance in the dataframe, after running it, I hope to store the score in a separate column named discountedCumulativeGain. relevance_df3 is of…
1
vote
0 answers

How to enforce a specific partitioning and sort order automatically with a UDAF in Spark?

I think the title of the question is quite clear. Based on the documentation regarding custom UDAFs, I want to develop a UDAF which uses a certain algorithm that relies on the fact that the reduce(b: BUF, a: IN): BUF function is called for inputs…
1
vote
2 answers

Issue While Creating Product of All Values Of Column (UDF in Snowflake)

I was trying to create a Snowflake SQL UDF Where it computes the Values of the all values and will return the result to the user. So firstly, i have tried the following approach # The UDF that Returns the Result. CREATE OR REPLACE FUNCTION…
1
vote
1 answer

Laravel Firebird Error "invalid request BLR at offset"

I'm trying to connect to .fdb using package in my web-app settings: 'firebird' => [ 'driver' => 'firebird', 'host' => 'localhost', 'port' => '3050', 'database' => storage_path('db.fdb'), 'username'…