Skip to content

addition-udf

What it does. Adds the numbers in a list and returns the total.

SELECT ADD(array(1, 2, 3)); -- 6.0
Input Result
array(1, 2, 3) 6.0
array(1, NULL, 3) 4.0 (empty values are skipped)
array() or only NULL values NULL
NULL NULL

The result is a DOUBLE, so very large whole numbers and some decimals can lose precision.

AdditionUdf implements the SparkUdf contract. getName() returns ADD. register() hands Spark a function that walks the array once, skips empty values and keeps a running total. The class is registered for discovery with @AutoService, so no service file needs to be written by hand.

<dependency>
<groupId>com.camelioflux.plugins.udf</groupId>
<artifactId>addition-udf</artifactId>
<version>1.0.0</version>
</dependency>
VersionReleasedJavadocLinks
1.0.0latest2026-12-05This siteMaven Central · Source
0.0.1-test1test2026-12-05javadoc.ioMaven Central · Source

Open the Javadoc for 1.0.0