Questions tagged [user-defined-aggregate]
38 questions
1
vote
0 answers
How to create a CLR user-defined function in SQL Server 2017
I have a SQL Server database project (sqlproj file) in which I have referenced an assembly containing a user-define aggregate function per…

Zenilogix
- 1,318
- 1
- 15
- 31
1
vote
1 answer
Field order on #region IBinarySerialize
I created IBinarySerialize region in order to create my CLR for my user defined aggregate. I am trying to replicate my XIRR function in C# just to learn how to work with CLRs. I put Write and Read in the same order but when I tried to build I get…

WinstonKyu
- 201
- 2
- 9
1
vote
0 answers
Group by a dataset and run Custom function in Spark Scala
I am using Spark Scala and have a dataset which I want to group by and then send the GroupedData to a a custom function. In the custom function, I would process the rows and update an empty dataframe.
I have the below dataframe…

Voila
- 85
- 2
- 15
1
vote
0 answers
C# edmx importing custom SQL Server aggregate fails
I've built a custom aggregate
CREATE AGGREGATE Helpers.Median(@input REAL)
RETURNS REAL EXTERNAL NAME Aggregates.Median
Written this in edmx:

user2820173
- 308
- 2
- 13
1
vote
1 answer
mariadb user defined aggregate function
I am using mariadb 10.3.9, and have created a user defined aggregate function (UDAF) and placed in a common_schema. This schema contains my utility functions to be used by other schema/databases on the same server.
The issue is that when calling the…

Ibrahim
- 11
- 2
1
vote
1 answer
Why scala WrappedArray[Int](null,null) returns 0 when apply, what happened?
While working in a sparkSql UDAF function I find some of my input columns turns from null to 0 unexpectedly.
With some REPL practice, it turns out the behavior is of scala 2.10.5.
code snap as bellow
import scala.collection.mutable
val wa =…

Kai
- 33
- 7
1
vote
1 answer
Compute difference between date and its previvous date
I have the following Dataframe:
---------+--------+----------+-----------+--------------------+--------------------+-------+-----+------------
| id|groupid|| field| oldstring| newstring| created| pkey| …

sirine
- 517
- 3
- 7
- 17
1
vote
2 answers
SQL Server CLR function aggregation of sorted string
In order to get a sorted aggregated string, I wrote the CLR function below. However, it always returns empty instead of what I expected, just like "001, 002, 003". I tried to debug the CLR function in visual studio 2017, but threw the error message…

Jimmy
- 45
- 1
- 7
1
vote
2 answers
SQLCLR custom aggregate with multiple sql_variant parameters
Hy,
I have post a question about CLR User-Defined Aggregates few month ago oon this post.
This works like a charm. But now I would like to quite the same functions with the two parameters in sql_variant type.
Like in my previous post, the two…

Cédric
- 17
- 5
1
vote
1 answer
Hive UDF With Parameters
I want to write a custom UDF (UDAF/UDTF) that can take in a constant parameter.
For example, I want to write a function MAX(COL, i), where COL is the collection of values to find the max value, and i is the position (ie. i = 1, find the highest, i =…

VerticalEvent
- 619
- 1
- 11
- 18
1
vote
2 answers
SQL Server user-defined aggregate returns an error if aggregating 0 rows
I have this SQL Server user-defined aggregate:
[SqlUserDefinedAggregate(Format.UserDefined, Name="median", IsInvariantToDuplicates=false, IsInvariantToNulls=true, IsInvariantToOrder=true, IsNullIfEmpty=true, MaxByteSize=8000)]
public class…

erikkallen
- 33,800
- 13
- 85
- 120
0
votes
1 answer
Create aggregate in postgres using C language
I want to create user-defined aggregate in postgres by C language. Here are my code.
sql code:
CREATE FUNCTION res_tras_crimes_c(state_c, int64)
RETURNS state_c
AS 'MODULE_PATHNAME', 'res_tras_crimes'
LANGUAGE C
…

Leo
- 1
- 1
0
votes
1 answer
KSQLDB: write custom UDAF with struct type (annotationparser exception)
Im trying to write a custom UDAF for KSQLDB.
First i wanted to try out the example: https://docs.ksqldb.io/en/latest/how-to-guides/create-a-user-defined-function/#implement-the-class
The Schemas of the structs will be submited via the…

Hansanho
- 295
- 1
- 3
- 13
0
votes
1 answer
How to improve query Performance while using SQLCLR user defined aggregate function(UDA)
We find the performance issue while using SQLCLR user defined aggregate function(UDA),
Here are our scenario:
We have 2 columns needed to calculate: key and value, whose value would…

othree
- 1
0
votes
0 answers
Spark UDAF with Window function
In order to achieve my requirement "Process the provided data using the provided external library", I had written an UDAF using spark-scala which was working fine until I get a scenario as below:
TestWindowFunc.scala
import…

Bala
- 11
- 4