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

Function datum_float8_cast

methods/array_ops/src/pg_gp/array_ops.c:1194–1221  ·  view source on GitHub ↗

----------------------------------------------------------------------- * Type cast functions * ----------------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

1192 * -----------------------------------------------------------------------
1193*/
1194static
1195inline
1196float8
1197datum_float8_cast(Datum elt, Oid element_type) {
1198 switch(element_type){
1199 case INT2OID:
1200 return (float8) DatumGetInt16(elt); break;
1201 case INT4OID:
1202 return (float8) DatumGetInt32(elt); break;
1203 case INT8OID:
1204 return (float8) DatumGetInt64(elt); break;
1205 case FLOAT4OID:
1206 return (float8) DatumGetFloat4(elt); break;
1207 case FLOAT8OID:
1208 return (float8) DatumGetFloat8(elt); break;
1209 case NUMERICOID:
1210 return DatumGetFloat8(
1211 DirectFunctionCall1(numeric_float8_no_overflow, elt));
1212 break;
1213 default:
1214 ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1215 errmsg("type is not supported"),
1216 errdetail("Arrays with element type %s are not supported.",
1217 format_type_be(element_type))));
1218 break;
1219 }
1220 return 0.0;
1221}
1222
1223static
1224inline

Callers 9

array_to_float8_arrayFunction · 0.85
array_filterFunction · 0.85
average_finalizeFunction · 0.85
average_root_finalizeFunction · 0.85
element_opFunction · 0.85
element_argmaxFunction · 0.85
element_argminFunction · 0.85
General_Array_to_ElementFunction · 0.85
General_Array_to_StructFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected