I have a JSONB column, which is a array of numbers. how can I modify the cubes to accept the sum of this pattern?
I already found a way to do the SUM in the SQL:
SELECT index
, (SELECT sum(nr::numeric) FROM jsonb_array_elements(snx_wavelengths) nr) AS wavelength_sum
FROM tbl
ORDER BY 1;
but I don't know how to implement this part in existent code:
(SELECT sum(nr::numeric) FROM jsonb_array_elements(snx_wavelengths) nr) AS wavelength_sum
I already tried to put the SQL direct on the functions, but no success.
In the future, I would like to create new functions like avg, standard deviation, etc..
Hello guys, I'm working with Postgresql + Cubes.
I have a JSONB column, which is a array of numbers. how can I modify the cubes to accept the sum of this pattern?
I already found a way to do the SUM in the SQL:
but I don't know how to implement this part in existent code:
(SELECT sum(nr::numeric) FROM jsonb_array_elements(snx_wavelengths) nr) AS wavelength_sum
I already tried to put the SQL direct on the functions, but no success.
In the future, I would like to create new functions like avg, standard deviation, etc..
Anyone can give me some path how to do that?
@Stiivi @pktippa