MCPcopy Create free account
hub / github.com/apache/madlib / array_square

Function array_square

methods/array_ops/src/pg_gp/array_ops.c:806–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804 */
805PG_FUNCTION_INFO_V1(array_square);
806Datum
807array_square(PG_FUNCTION_ARGS){
808 if (PG_ARGISNULL(0)) { PG_RETURN_NULL(); }
809
810 ArrayType *x = PG_GETARG_ARRAYTYPE_P(0);
811 ArrayType *v1 = array_to_float8_array(x);
812 Datum v2 = 0;
813
814 ArrayType *res = General_Array_to_Array(v1, v2, element_square);
815
816 if (v1 != x) { pfree(v1); }
817 PG_FREE_IF_COPY(x, 0);
818
819 PG_RETURN_ARRAYTYPE_P(res);
820}
821
822/*
823 * This function sets all elements to be the specified value.

Callers

nothing calls this directly

Calls 2

array_to_float8_arrayFunction · 0.85
General_Array_to_ArrayFunction · 0.85

Tested by

no test coverage detected