uda-sample.cc
// A serialize function is necesary to free the intermediate state allocation. We use the
// StringVal constructor to allocate memory owned by Impala, copy the intermediate
// StringVal, and free the intermediate's memory. Note that memory allocated by the
// StringVal ctor is not necessarily persisted across UDA function calls, which is why we
// don't use it in StringConcatUpdate().
A serialize function is necesary to free the intermediate state allocation. We use the
StringVal constructor to allocate memory owned by Impala, copy the intermediate
StringVal, and free the intermediate's memory. Note that memory allocated by the
StringVal ctor is not necessarily persisted across UDA function calls, which is why we
don't use it in StringConcatUpdate().
A serialize function is necesary to free the intermediate state allocation . We use the StringVal constructor to allocate memory owned by Impala copy the intermediate StringVal and free the intermediate ' s memory . Note that memory allocated by the StringVal ctor is not necessarily persisted across UDA function calls which is why we don ' t use it in StringConcatUpdate () .
StringVal StringConcatSerialize(FunctionContext* context, const StringVal& val) {
  if (val.is_null) return val;
  StringVal result = StringVal::CopyFrom(context, val.ptr, val.len);
  context->Free(val.ptr);
  return result;
}
StringVal StringConcatSerialize ( FunctionContext * context , const StringVal & val ) { if ( val . is_null ) return val ; StringVal result = StringVal :: CopyFrom ( context , val . ptr , val . len ) ; context -> Free ( val . ptr ) ; return result ; }
A serialize function is necesary to free the intermediate state allocation.
A serialize function is necesary to free the intermediate state allocation .
// Copy the value into Impala-managed memory with StringVal::CopyFrom(). // NB: CopyFrom() will return a null StringVal and and fail the query if the allocation // fails because of lack of memory.