MCPcopy Create free account
hub / github.com/apache/impala / DecimalVal VarSum

Function DecimalVal VarSum

be/src/testutil/test-udfs.cc:132–148  ·  view source on GitHub ↗

Decimal4Value... => Decimal8Value

Source from the content-addressed store, hash-verified

130
131// Decimal4Value... => Decimal8Value
132IMPALA_UDF_EXPORT
133DecimalVal VarSum(FunctionContext* context, int n, const DecimalVal* args) {
134 int64_t result = 0;
135 bool is_null = true;
136 for (int i = 0; i < n; ++i) {
137 const FunctionContext::TypeDesc* desc = context->GetArgType(i);
138 if (desc->type != FunctionContext::TYPE_DECIMAL || desc->precision > 9) {
139 context->SetError("VarSum() only accepts Decimal4Value (precison <= 9)");
140 return DecimalVal::null();
141 }
142 if (args[i].is_null) continue;
143 result += args[i].val4;
144 is_null = false;
145 }
146 if (is_null) return DecimalVal::null();
147 return DecimalVal(result);
148}
149
150IMPALA_UDF_EXPORT
151DoubleVal NO_INLINE VarSumMultiply(FunctionContext* context,

Callers

nothing calls this directly

Calls 3

DecimalValClass · 0.85
GetArgTypeMethod · 0.80
SetErrorMethod · 0.45

Tested by

no test coverage detected