[Bug][Function] Fix rand() function return same value (#4709)

fix rand function return same value when no parameter
This commit is contained in:
Zhengguo Yang
2020-10-11 15:40:38 +08:00
committed by GitHub
parent 04f26e4b7f
commit 98e71a8b9f
6 changed files with 83 additions and 18 deletions

View File

@ -22,7 +22,6 @@
#include "runtime/mem_pool.h"
#include "runtime/mem_tracker.h"
#include "udf/udf_internal.h"
#include "udf/udf.h"
namespace doris {
@ -44,6 +43,14 @@ FunctionUtils::FunctionUtils(RuntimeState* state) {
_state, _memory_pool, return_type, arg_types, 0, false);
}
FunctionUtils::FunctionUtils(const doris_udf::FunctionContext::TypeDesc& return_type,
const std::vector<doris_udf::FunctionContext::TypeDesc>& arg_types, int varargs_buffer_size) {
_mem_tracker.reset(new MemTracker(-1, "function util"));
_memory_pool = new MemPool(_mem_tracker.get());
_fn_ctx = FunctionContextImpl::create_context(
_state, _memory_pool, return_type, arg_types, varargs_buffer_size, false);
}
FunctionUtils::~FunctionUtils() {
_fn_ctx->impl()->close();
delete _fn_ctx;