5,519 questions
1
vote
1
answer
208
views
An R-function for Creating a String
When typing
gsub(" ", "", gsub("\"", "", deparse(quote(2025-B3))))
the output is [1] "2025-B3"
Typing
gsub(" ", "", gsub(&...
0
votes
0
answers
71
views
Cannot successfully create the simplest LibreOffice extension for UDF's
New here. Beginner with Python and LibreOffice. Some experience with C#.
OS: Win 11
LO: 25.8
I have been trying to learn how to create a LO extension to provide UDF's for use in LO Calc. I have dozens ...
2
votes
1
answer
105
views
Why UDF returns NULL for multi-row query but not for single row?
I ran the following query to retrieve data for a single investment ID:
select *, getProductClass(InstrumentID, etf_option_mapper) as ProductClass
from investor_pos
where InvestorID = '7399000270'
...
0
votes
1
answer
214
views
polars map_batches return_dtype argument for arrays
I am applying a user defined function (UDF) to a polars dataframe using the map_batches function (c.p. https://docs.pola.rs/user-guide/expressions/user-defined-python-functions/#combining-multiple-...
0
votes
0
answers
20
views
Why does the object ‘date’ trigger ‘neither XDB connection nor function’ error in my function?
I’m encountering an error when defining a query function in DolphinDB. Here’s my scenario:
Table Definition:
dt = 2025.01.01T01:01:51.100 2025.01.02T01:01:51.000 2025.01.03T04:01:51.900
sym = ["...
1
vote
1
answer
128
views
How do I load joblib file on spark?
I have following Code. It reads a pre-existing file for a ML model. I am trying to run it on databricks on multiple cases
import numpy as np
import joblib
class WeightedEnsembleRegressor:
"&...
0
votes
1
answer
57
views
The "Sheet" function in Uno FunctionAccess always returns "2"
This function:
Function SheetIndex() As Long
Dim oFunctionAccess As Object
oFunctionAccess = CreateUnoService("com.sun.star.sheet.FunctionAccess")
SheetIndex = oFunctionAccess....
0
votes
1
answer
89
views
MyEval creates a circular reference, how is this possible?
When there are multiple cells using this UDF, they give results but they are recalculated endlessly and most of the time most of the cells give circular reference error (Err:522):
Option Explicit
...
0
votes
1
answer
71
views
Use threading for UDF in databricks to use new api token
I have a dataframe that needs to be used row-wise for API calls. Therefore I implemented a UDF for it. It takes each row uses the data from that row to make an api call and stores an id from the ...
1
vote
1
answer
73
views
Function to add a command line to an existing function [closed]
I need to write a function to add a particular command/string of characters to an existing function.
Consider this function:
constraint = function(cov_matrix,max_variance){
function(x){
f = NULL
g =...
3
votes
1
answer
111
views
powershell user defined function not working with an alias - odd error message
working in Windows 11 with PowerShell 7.5.1 (NOT Windows PowerShell)
i have some functions and aliases defined in
C:\Users\Jeff\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
here are the ...
-6
votes
1
answer
107
views
Calculate Running Best Ask Using SQL or UDTF?
I have an enormous list of new/replacement/cancel stock quotes (billions of rows) and I want to calculate the running best (lowest) ask at the time of each row. Cancels and replacements are ...
0
votes
1
answer
19
views
How to Add an Auto-Incrementing ID Column to the result table of the Reactive State Engine in DolphinDB?
I need to maintain an auto-incrementing ID field for each stock as an identifier in DolphinDB's Reactive State Engine for real-time data processing. However, there are no relevant parameters in the ...
3
votes
2
answers
94
views
Call large SQL queries from inside procedures or functions to create common helper functions in Snowflake
I have a system where I need to identify different types of risk associated with entities. I have many large scripts for detecting different risk behaviours associated with entities, with some scripts ...
1
vote
1
answer
48
views
Excel UDF using Visual Studio and intellisense
I am trying to add intellisense to my UDFs and I was advised to try excel-dna. It has me install Visual Studio and create a project. I followed the instructions here: https://excel-dna.net/docs/...
1
vote
1
answer
55
views
udf returning Ljava.lang.Object;@ [closed]
I have a PySpark UDF which when I try to apply to each row for one of the df columns and get a new column, I get a [Ljava.lang.Object;@7e44638d (different value after the @ for each row)
Please see ...
1
vote
1
answer
66
views
Snowflake UDF error - Unsupported subquery type cannot be evaluated
I've tried several strategies to force Snowflake to recognize that I'm only returning one row per input row, including:
Aggregation with Min(), Max(), and Any_Value()
Using LIMIT 1
Putting my logic ...
1
vote
1
answer
86
views
Adding more data causes Pandas UDF to return error
I am new to Pyspark and I have created a pandas udf. The purpose of this udf is to accept a series and apply an ML model on it. I have data that has these columns:
ID, models_name, prices, units_sold, ...
0
votes
0
answers
79
views
Excel UDF: use Characters object without ScreenUpdating
It appears that if an Excel VBA user-defined function makes use of a Characters object, the cell in which that function is used displays some part of that object while the VBA code is running, even if ...
0
votes
1
answer
174
views
Passing values from a CTE (Common Table Expression) to user-defined functions (UDF) in Spark SQL / Databricks
I'm trying to pass a value from a CTE to my function (UDF). Unfortunately, it's not working.
Here is the first variant:
WITH fx_date_new AS (
SELECT CASE
WHEN '2025-01-01' > ...
0
votes
1
answer
40
views
Identifying and Updating UDF Dependencies for Hive Metastore to Unity Catalog Migration
I am currently working on a Hive Metastore to Unity Catalog migration in Databricks. As part of this process, I need to upgrade several components, including workflows and clusters.
I would like ...
1
vote
0
answers
98
views
Snowflake: "Unsupported subquery type cannot be evaluated" when using a function with a subquery on a JSON column
In Snowflake I'm trying to de-identify data stored in a JSON column based on configurations in a separate table. I created a custom SQL function DEIDENTIFY_JSON which uses a subquery to look up the de-...
1
vote
2
answers
144
views
How to write Excel UDF so that it can handle being passed a single cell, or array of cells
Background
I wrote the below UDF to check whether a cell's contents is valid (i.e. if a cell's data validation is set to a list of A,B,C. Returns TRUE if the cell is "A", "B" or &...
0
votes
0
answers
55
views
Using pyspark databricks UDFs with outside function imports
Problem with minimal example
The below minimal example does not run locally with databricks-connect==15.3 but does run within databricks workspace.
main.py
from databricks.connect import ...
0
votes
1
answer
205
views
Error with Excel Lambda function in Name manager
I have set up a Lambda formula that calculates interpolated values from a given set of coordinates
similar to existing trend/linest/forecast functions
handles non consecutive inputs as well as errors ...
1
vote
1
answer
34
views
import script value in different script with new results (diceroller)
I'm learning to write python to create scripts to automate stuff for DD.
And I'm positive that there most likely is a built in solution for this.
I have certain functions from external scripts that I ...
-1
votes
1
answer
89
views
np.clip functionality using pyarrow compute in duckdb udf
Iam currently working on a duckdb udf using pyarrow compute. Works great so far.
Now i need to clip a value between 0 and 1, e.g minimal example:
import numpy as np
import pyarrow as pa
import pyarrow....
0
votes
1
answer
24
views
postgresql cannot use concatenated variables in user defined function
Creating function to extract data from views, whose name prefix is passed as function parameter:
CREATE FUNCTION t (char(2)) RETURNS text AS $$
DECLARE view_name TEXT;
BEGIN
view_name := CONCAT($1, '...
3
votes
2
answers
61
views
postgresql concat error when used in function
PostgreSQL syntax error when using CONCAT in user defined function.
Using DbVisualizer as SQL client.
CREATE FUNCTION t() RETURNS TEXT
AS ' SELECT CONCAT('some', '_text') ; '
LANGUAGE plpgsql;
[Code:...
0
votes
0
answers
30
views
Set field of java UDF instance in spark driver and use in executors
Is it possible to set field on the UDF instance in driver and use it by the executors when call() is invoked?
public class SomeUDF implements UDF2<String, String, String> {
private String ...
1
vote
0
answers
113
views
Getting PySpark UDF logs from Executor running in Databricks
Not able to get log4j logs from executor that invoked in UDF when running PySprak in Databricks.
in Databricks webportal I created Compute cluster, in the Libraries tab I add jar with class ...
1
vote
1
answer
76
views
Dynamically Access Columns and Cast Data Types in PostgreSQL Functions
In custom functions in PostgreSQL, I can access the NEW object to retrieve the values of specific columns, for example:
NEW.description
NEW.city
Essentially, this is a static reference at the code-...
0
votes
1
answer
27
views
How to get running count as part of a query in Apache Derby
I am trying to get a sort of "running count" from data in a Apache Derby database.
E.g. sample selected data
Part1
Part2
d1
a1
d1
a2
d2
a1
d2
a2
I would like to write a SQL statement which ...
3
votes
1
answer
393
views
Python polars: pass named row to pl.DataFrame.map_rows
I'm looking for a way to apply a user defined function taking a dictionary, and not a tuple, of arguments as input when using pl.DataFrame.map_rows.
Trying something like
df.map_rows(lambda x: udf({k:...
0
votes
0
answers
91
views
Unable to call Snowflake UDTF with bind argument inside the FROM clause in a stored procedure
Background
I created a Snowflake UDTF (user-defined table function) GET_MEDICATION that accepts language_key as input argument to return the data in the language_key specified while calling it.
Query:
...
0
votes
1
answer
72
views
UDF Write Generation Check within UDF context
I Have Use case for Aerospike where I have multiple Records like:
+--------+---------+
| PK | signal |
+--------+---------+
| 123451 | 1 |
| 102221 | 1.0816 |
+--------+---------+
I have ...
0
votes
0
answers
39
views
Stateful Java UDF in PySpark
I want to create a UDF for PySpark based on some Java code. The UDF signature is quite similar to regex match. The first argument will come from data frames, while the second will be the same. The ...
0
votes
0
answers
109
views
Is it possible to redefine or create a new dunder method to built in objects like int? [duplicate]
I’m trying to define a new type of division such that 1/0 doesn’t raise a ZeroDivisionError, instead, it returns a new object called infty(0), which is defined as follow:
class infty:
def ...
0
votes
1
answer
129
views
Deterministic Property not Working as Expected in UDF
I am creating an UDF expecting to be deterministic, i.e., it should give same result for same input. But it is not working as expected when the table is updated.
Step #1. Create a table and insert few ...
0
votes
0
answers
78
views
Error while using stored procedure in distributed transaction
I am not good at databases and SQL and have not worked on complex tasks. I will try to explain as best as I can. Thanks for your help.
We are performing proof-of-concept (POC) and we are facing some ...
0
votes
1
answer
136
views
Maintaining Consistency Between Python (e.g. Polars) Functions and SQL (e.g. Redshift) UDFs
I'm working on a data engineering project that processes data from multiple sources using Polars in Python and Redshift as a data warehouse. I need a robust strategy for keeping Python Polars ...
-1
votes
1
answer
54
views
Snowflake UDF - unsupported subquery type
I am trying to create a function that will return a label based on a score and version number in a look up table
so i have a look up table
label
version
min
max
High
1
7
10
Med
1
3
6
Low
1
0
2
High
2
...
1
vote
1
answer
76
views
MsgBox for error handling in a VBA UDF called from cells in Excel?
Is it possible to allow Excel users to stop MsgBox messages from VBA error handlers popping up and also re-allowing MsgBox messages? Or is it possible to programmatically control their frequency, for ...
1
vote
0
answers
71
views
Implemented syscall but getting "Function not implemented" error
Trying to implemented syscall in kernel space and wrapper in glibc so I can call from userspace.
When I call the function call in user program it says "Function not implemented".
I have ...
1
vote
1
answer
162
views
Not able to fetch UDF fields using XML Request in Tally API
I am using following xml request to get Vouchers from Tally and gives me below output.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export&...
0
votes
1
answer
71
views
LO Calc BASIC wrapper for python array functions
How can I construct simple LibreOffice basic wrapper, that could read an arbitrary array from LO calc spreadsheet to preform some python function on it, say add all the values?
Here is example of some ...
0
votes
2
answers
122
views
Scaling OSMNX library's 'nearest_edges' function on huge spark dataset
I am trying to scale the distance value returned from the 'nearest_edges' function(from the OSMNX library) on a huge dataset using the lat and long columns as my inputs to the creation of my ...
0
votes
0
answers
56
views
Converting UDF from postgres to snowflake
I’m currently trying to migrate some functions from postgres to Snowflake and having some trouble, I’m hoping someone can give some advice.
Within postgres I currently have a conversion function that ...
0
votes
1
answer
312
views
Snowflake UDF using column as parameter
Is it possible to call a UDF in Snowflake using a view column as an input parameter? I have a column with multiple dates delimited by | and I want to check if at least one of those dates falls between ...
0
votes
1
answer
130
views
Running into pyspark.sql.utils.AnalysisException: UDF class doesn't implement any UDF interface
I am trying to utilize Scala udfs from pyspark and running into 'pyspark.sql.utils.AnalysisException: UDF class doesn't implement any UDF interface' error
My scala code looks something like this
...