This repository contains the JSON_SUM aggregation function. It combines all the JSONs in a column by adding the shared keys and appending the rest. It's used as an example for our How to write custom Presto functions blogpost.
Targets Trino 470. Build requires JDK 23.
Inside the presto-udfs folder, run:
mvn clean packageTo setup a Docker container with the UDFs, run:
docker run --name trino -p 8080:8080 -v $PWD/presto-udfs/target/trino-jampp-udfs-470/:/usr/lib/trino/plugin/udfs trinodb/trino:470This will add the UDFs to the /usr/lib/trino/plugin/ folder inside the container.
You can then connect to the Trino server through the Trino CLI.
If you run the SHOW FUNCTIONS; command, you should see the json_sum on the list (it will appear once per input type).