MCPcopy Create free account
hub / github.com/apache/impala / ValidateFunctionContext2

Function ValidateFunctionContext2

be/src/testutil/test-udas.cc:108–120  ·  view source on GitHub ↗

Defines AggDecimalIntermediate(DECIMAL(1,2), INT) returns DECIMAL(5,6) intermediate DECIMAL(3,4) Useful to test that type parameters are plumbed through.

Source from the content-addressed store, hash-verified

106// intermediate DECIMAL(3,4)
107// Useful to test that type parameters are plumbed through.
108static void ValidateFunctionContext2(const FunctionContext* context) {
109 assert(context->GetNumArgs() == 2);
110 assert(context->GetArgType(0)->type == FunctionContext::TYPE_DECIMAL);
111 assert(context->GetArgType(0)->precision == 2);
112 assert(context->GetArgType(0)->scale == 1);
113 assert(context->GetArgType(1)->type == FunctionContext::TYPE_INT);
114 assert(context->GetIntermediateType().type == FunctionContext::TYPE_DECIMAL);
115 assert(context->GetIntermediateType().precision == 4);
116 assert(context->GetIntermediateType().scale == 3);
117 assert(context->GetReturnType().type == FunctionContext::TYPE_DECIMAL);
118 assert(context->GetReturnType().precision == 6);
119 assert(context->GetReturnType().scale == 5);
120}
121IMPALA_UDF_EXPORT
122void AggDecimalIntermediateUpdate(FunctionContext* context, const DecimalVal&,
123 const IntVal&, DecimalVal*) {

Calls 2

GetNumArgsMethod · 0.80
GetArgTypeMethod · 0.80

Tested by

no test coverage detected