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

Function MinUpdate

be/src/udf/uda-test.cc:103–114  ·  view source on GitHub ↗

Update the min value, comparing with the current value in MinState

Source from the content-addressed store, hash-verified

101
102// Update the min value, comparing with the current value in MinState
103void MinUpdate(FunctionContext* context, const StringVal& input, BufferVal* val) {
104 if (input.is_null) return;
105 MinState* state = reinterpret_cast<MinState*>(*val);
106 if (state->value == NULL) {
107 state->Set(context, input);
108 return;
109 }
110 int cmp = memcmp(input.ptr, state->value, ::min(input.len, state->len));
111 if (cmp < 0 || (cmp == 0 && input.len < state->len)) {
112 state->Set(context, input);
113 }
114}
115
116// Serialize the state into the min string
117BufferVal MinSerialize(FunctionContext* context, const BufferVal& intermediate) {

Callers 1

MinMergeFunction · 0.85

Calls 2

minFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected