[refactor] replace boost smart ptr with stl (#6856)
1. replace all boost::shared_ptr to std::shared_ptr 2. replace all boost::scopted_ptr to std::unique_ptr 3. replace all boost::scoped_array to std::unique<T[]> 4. replace all boost:thread to std::thread
This commit is contained in:
@ -35,7 +35,7 @@
|
||||
namespace doris {
|
||||
|
||||
ExprContext::ExprContext(Expr* root)
|
||||
: _fn_contexts_ptr(NULL),
|
||||
: _fn_contexts_ptr(nullptr),
|
||||
_root(root),
|
||||
_is_clone(false),
|
||||
_prepared(false),
|
||||
@ -53,7 +53,7 @@ ExprContext::~ExprContext() {
|
||||
Status ExprContext::prepare(RuntimeState* state, const RowDescriptor& row_desc,
|
||||
const std::shared_ptr<MemTracker>& tracker) {
|
||||
DCHECK(tracker != nullptr) << std::endl << get_stack_trace();
|
||||
DCHECK(_pool.get() == NULL);
|
||||
DCHECK(_pool.get() == nullptr);
|
||||
_prepared = true;
|
||||
// TODO: use param tracker to replace instance_mem_tracker, be careful about tracker's life cycle
|
||||
// _pool.reset(new MemPool(new MemTracker(-1)));
|
||||
@ -91,8 +91,8 @@ void ExprContext::close(RuntimeState* state) {
|
||||
for (int i = 0; i < _fn_contexts.size(); ++i) {
|
||||
_fn_contexts[i]->impl()->close();
|
||||
}
|
||||
// _pool can be NULL if Prepare() was never called
|
||||
if (_pool != NULL) {
|
||||
// _pool can be nullptr if Prepare() was never called
|
||||
if (_pool != nullptr) {
|
||||
_pool->free_all();
|
||||
}
|
||||
_closed = true;
|
||||
@ -111,7 +111,7 @@ int ExprContext::register_func(RuntimeState* state,
|
||||
Status ExprContext::clone(RuntimeState* state, ExprContext** new_ctx) {
|
||||
DCHECK(_prepared);
|
||||
DCHECK(_opened);
|
||||
DCHECK(*new_ctx == NULL);
|
||||
DCHECK(*new_ctx == nullptr);
|
||||
|
||||
*new_ctx = state->obj_pool()->add(new ExprContext(_root));
|
||||
(*new_ctx)->_pool.reset(new MemPool(_pool->mem_tracker()));
|
||||
@ -130,7 +130,7 @@ Status ExprContext::clone(RuntimeState* state, ExprContext** new_ctx) {
|
||||
Status ExprContext::clone(RuntimeState* state, ExprContext** new_ctx, Expr* root) {
|
||||
DCHECK(_prepared);
|
||||
DCHECK(_opened);
|
||||
DCHECK(*new_ctx == NULL);
|
||||
DCHECK(*new_ctx == nullptr);
|
||||
|
||||
*new_ctx = state->obj_pool()->add(new ExprContext(root));
|
||||
(*new_ctx)->_pool.reset(new MemPool(_pool->mem_tracker()));
|
||||
@ -175,12 +175,12 @@ bool ExprContext::is_nullable() {
|
||||
void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
switch (e->_type.type) {
|
||||
case TYPE_NULL: {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
case TYPE_BOOLEAN: {
|
||||
doris_udf::BooleanVal v = e->get_boolean_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.bool_val = v.val;
|
||||
return &_result.bool_val;
|
||||
@ -188,7 +188,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_TINYINT: {
|
||||
doris_udf::TinyIntVal v = e->get_tiny_int_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.tinyint_val = v.val;
|
||||
return &_result.tinyint_val;
|
||||
@ -196,7 +196,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_SMALLINT: {
|
||||
doris_udf::SmallIntVal v = e->get_small_int_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.smallint_val = v.val;
|
||||
return &_result.smallint_val;
|
||||
@ -204,7 +204,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_INT: {
|
||||
doris_udf::IntVal v = e->get_int_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.int_val = v.val;
|
||||
return &_result.int_val;
|
||||
@ -212,7 +212,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_BIGINT: {
|
||||
doris_udf::BigIntVal v = e->get_big_int_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.bigint_val = v.val;
|
||||
return &_result.bigint_val;
|
||||
@ -220,7 +220,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_LARGEINT: {
|
||||
doris_udf::LargeIntVal v = e->get_large_int_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.large_int_val = v.val;
|
||||
return &_result.large_int_val;
|
||||
@ -228,7 +228,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_FLOAT: {
|
||||
doris_udf::FloatVal v = e->get_float_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.float_val = v.val;
|
||||
return &_result.float_val;
|
||||
@ -237,7 +237,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_DOUBLE: {
|
||||
doris_udf::DoubleVal v = e->get_double_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.double_val = v.val;
|
||||
return &_result.double_val;
|
||||
@ -259,7 +259,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_CHAR: {
|
||||
doris_udf::StringVal v = e->get_string_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.string_val.ptr = reinterpret_cast<char*>(v.ptr);
|
||||
_result.string_val.len = v.len;
|
||||
@ -274,7 +274,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_DATETIME: {
|
||||
doris_udf::DateTimeVal v = e->get_datetime_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.datetime_val = DateTimeValue::from_datetime_val(v);
|
||||
return &_result.datetime_val;
|
||||
@ -282,7 +282,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_DECIMALV2: {
|
||||
DecimalV2Val v = e->get_decimalv2_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_result.decimalv2_val = DecimalV2Value::from_decimal_val(v);
|
||||
return &_result.decimalv2_val;
|
||||
@ -290,7 +290,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
case TYPE_ARRAY: {
|
||||
doris_udf::CollectionVal v = e->get_array_val(this, row);
|
||||
if (v.is_null) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_result.array_val = CollectionValue::from_collection_val(v);
|
||||
@ -298,7 +298,7 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
|
||||
}
|
||||
default:
|
||||
DCHECK(false) << "Type not implemented: " << e->_type;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ Status ExprContext::get_const_value(RuntimeState* state, Expr& expr, AnyVal** co
|
||||
const TypeDescriptor& result_type = expr.type();
|
||||
ObjectPool* obj_pool = state->obj_pool();
|
||||
*const_val = create_any_val(obj_pool, result_type);
|
||||
if (*const_val == NULL) {
|
||||
if (*const_val == nullptr) {
|
||||
return Status::InternalError("Could not create any val");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user