fix some bug for auto_mem_mgr && fix bug for nanvl

This commit is contained in:
18523270951@163.com
2023-06-09 03:48:03 +00:00
committed by ob-robot
parent 336122a2d2
commit bbf9072380
10 changed files with 42 additions and 40 deletions

View File

@ -1861,7 +1861,7 @@ int ObAggregateProcessor::generate_group_row(GroupRow *&new_group_row,
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else {
GroupConcatExtraResult *result = new (tmp_buf) GroupConcatExtraResult(aggr_alloc_);
GroupConcatExtraResult *result = new (tmp_buf) GroupConcatExtraResult(aggr_alloc_, op_monitor_info_);
aggr_cell.set_extra(result);
const bool need_rewind = (in_window_func_ || group_id > 0);
if (OB_FAIL(result->init(eval_ctx_.exec_ctx_.get_my_session()->get_effective_tenant_id(),
@ -1904,7 +1904,7 @@ int ObAggregateProcessor::generate_group_row(GroupRow *&new_group_row,
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", "size", sizeof(HybridHistExtraResult));
} else {
HybridHistExtraResult *result = new (tmp_buf) HybridHistExtraResult(aggr_alloc_);
HybridHistExtraResult *result = new (tmp_buf) HybridHistExtraResult(aggr_alloc_, op_monitor_info_);
aggr_cell.set_extra(result);
const bool need_rewind = (in_window_func_ || group_id > 0);
if (OB_FAIL(result->init(eval_ctx_.exec_ctx_.get_my_session()->get_effective_tenant_id(),
@ -1927,7 +1927,7 @@ int ObAggregateProcessor::generate_group_row(GroupRow *&new_group_row,
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else {
TopKFreHistExtraResult *result = new (tmp_buf) TopKFreHistExtraResult(aggr_alloc_);
TopKFreHistExtraResult *result = new (tmp_buf) TopKFreHistExtraResult(aggr_alloc_, op_monitor_info_);
aggr_cell.set_extra(result);
}
break;
@ -1937,24 +1937,23 @@ int ObAggregateProcessor::generate_group_row(GroupRow *&new_group_row,
CK(NULL != aggr_info.dll_udf_);
DllUdfExtra *extra = NULL;
if (OB_SUCC(ret)) {
extra = OB_NEWx(DllUdfExtra, (&aggr_alloc_),
aggr_alloc_);
if (NULL == extra) {
void *tmp_buf = NULL;
if (OB_ISNULL(tmp_buf = aggr_alloc_.alloc(sizeof(DllUdfExtra)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
}
aggr_cell.set_extra(extra);
}
if (OB_SUCC(ret)) {
OZ(ObUdfUtil::init_udf_args(aggr_alloc_,
} else {
DllUdfExtra *extra = new (tmp_buf) DllUdfExtra(aggr_alloc_, op_monitor_info_);
aggr_cell.set_extra(extra);
OZ(ObUdfUtil::init_udf_args(aggr_alloc_,
aggr_info.dll_udf_->udf_attributes_,
aggr_info.dll_udf_->udf_attributes_types_,
extra->udf_ctx_.udf_args_));
OZ(aggr_info.dll_udf_->udf_func_.process_init_func(extra->udf_ctx_));
if (OB_SUCC(ret)) { // set func after udf ctx inited
extra->udf_fun_ = &aggr_info.dll_udf_->udf_func_;
OZ(aggr_info.dll_udf_->udf_func_.process_init_func(extra->udf_ctx_));
if (OB_SUCC(ret)) { // set func after udf ctx inited
extra->udf_fun_ = &aggr_info.dll_udf_->udf_func_;
}
OZ(extra->udf_fun_->process_clear_func(extra->udf_ctx_));
}
OZ(extra->udf_fun_->process_clear_func(extra->udf_ctx_));
}
break;
}
@ -1971,7 +1970,7 @@ int ObAggregateProcessor::generate_group_row(GroupRow *&new_group_row,
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("allocate memory failed", K(ret));
} else {
ExtraResult *result = new (tmp_buf) ExtraResult(aggr_alloc_);
ExtraResult *result = new (tmp_buf) ExtraResult(aggr_alloc_, op_monitor_info_);
aggr_cell.set_extra(result);
}
}

View File

@ -280,8 +280,8 @@ public:
{
public:
// %alloc is used to initialize the structures, can not be used to hold the data
explicit ExtraResult(common::ObIAllocator &alloc)
: alloc_(alloc), unique_sort_op_(NULL)
explicit ExtraResult(common::ObIAllocator &alloc, ObMonitorNode &op_monitor_info)
: alloc_(alloc), op_monitor_info_(op_monitor_info), unique_sort_op_(NULL)
{}
virtual ~ExtraResult();
virtual void reuse();
@ -293,7 +293,7 @@ public:
DECLARE_VIRTUAL_TO_STRING;
protected:
common::ObIAllocator &alloc_;
ObMonitorNode op_monitor_info_;
ObMonitorNode &op_monitor_info_;
public:
// for distinct calculate may be replace by hash based distinct in the future.
ObUniqueSortImpl *unique_sort_op_;
@ -302,8 +302,8 @@ public:
struct TopKFreHistExtraResult : public ExtraResult
{
public:
TopKFreHistExtraResult(common::ObIAllocator &alloc)
: ExtraResult(alloc), topk_fre_hist_() {}
TopKFreHistExtraResult(common::ObIAllocator &alloc, ObMonitorNode &op_monitor_info)
: ExtraResult(alloc, op_monitor_info), topk_fre_hist_() {}
virtual ~TopKFreHistExtraResult() {}
virtual void reuse()
{
@ -317,8 +317,8 @@ public:
class GroupConcatExtraResult : public ExtraResult
{
public:
explicit GroupConcatExtraResult(common::ObIAllocator &alloc)
: ExtraResult(alloc), row_count_(0), iter_idx_(0), sort_op_(NULL), separator_datum_(NULL), bool_mark_(alloc)
explicit GroupConcatExtraResult(common::ObIAllocator &alloc, ObMonitorNode &op_monitor_info)
: ExtraResult(alloc, op_monitor_info), row_count_(0), iter_idx_(0), sort_op_(NULL), separator_datum_(NULL), bool_mark_(alloc)
{
}
virtual ~GroupConcatExtraResult();
@ -383,8 +383,8 @@ public:
class HybridHistExtraResult : public ExtraResult
{
public:
explicit HybridHistExtraResult(common::ObIAllocator &alloc)
: ExtraResult(alloc),
explicit HybridHistExtraResult(common::ObIAllocator &alloc, ObMonitorNode &op_monitor_info)
: ExtraResult(alloc, op_monitor_info),
sort_row_count_(0),
material_row_count_(0),
sort_op_(nullptr),
@ -425,8 +425,8 @@ public:
struct DllUdfExtra : public ExtraResult
{
explicit DllUdfExtra(common::ObIAllocator &alloc)
: ExtraResult(alloc), udf_fun_(NULL)
explicit DllUdfExtra(common::ObIAllocator &alloc, ObMonitorNode &op_monitor_info)
: ExtraResult(alloc, op_monitor_info), udf_fun_(NULL)
{
}

View File

@ -662,8 +662,8 @@ int ObHashGroupByOp::init_distinct_info(bool is_part)
&ctx_.get_allocator(),
tenant_id,
est_size,
PHY_HASH_DISTINCT, // hardcode to distinct
MY_SPEC.id_ + 1, // for unique, using op_id + 1
MY_SPEC.type_,
MY_SPEC.id_,
&ctx_))) {
LOG_WARN("failed to init sql mem processor", K(ret));
} else if (is_part) {