adding helper method to be abel to pass 2D arrays from postgresql to python
This commit is contained in:
parent
03aada8758
commit
8cbc29a3e6
19
src/pg/sql/04_py_agg.sql
Normal file
19
src/pg/sql/04_py_agg.sql
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION
|
||||||
|
CDB_PyAggS(current_state Numeric[], current_row Numeric[])
|
||||||
|
returns NUMERIC[] as $$
|
||||||
|
BEGIN
|
||||||
|
if array_upper(current_state,1) is null then
|
||||||
|
RAISE NOTICE 'setting state %',array_upper(current_row,1);
|
||||||
|
current_state[1] = array_upper(current_row,1);
|
||||||
|
end if;
|
||||||
|
return array_cat(current_state,current_row) ;
|
||||||
|
END
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE AGGREGATE CDB_PyAgg(NUMERIC[])(
|
||||||
|
SFUNC = CDB_PyAggS,
|
||||||
|
STYPE = Numeric[],
|
||||||
|
INITCOND = "{}"
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user