[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:
@ -65,7 +65,7 @@ void init_builtins_dummy() {
|
||||
// Call one function from each of the classes to pull all the symbols
|
||||
// from that class in.
|
||||
// TODO: is there a better way to do this?
|
||||
AggregateFunctions::init_null(NULL, NULL);
|
||||
AggregateFunctions::init_null(nullptr, nullptr);
|
||||
}
|
||||
|
||||
FunctionContext* Expr::register_function_context(ExprContext* ctx, RuntimeState* state,
|
||||
@ -243,12 +243,12 @@ Expr::~Expr() {}
|
||||
Status Expr::create_expr_tree(ObjectPool* pool, const TExpr& texpr, ExprContext** ctx) {
|
||||
// input is empty
|
||||
if (texpr.nodes.size() == 0) {
|
||||
*ctx = NULL;
|
||||
*ctx = nullptr;
|
||||
return Status::OK();
|
||||
}
|
||||
int node_idx = 0;
|
||||
Expr* e = NULL;
|
||||
Status status = create_tree_from_thrift(pool, texpr.nodes, NULL, &node_idx, &e, ctx);
|
||||
Expr* e = nullptr;
|
||||
Status status = create_tree_from_thrift(pool, texpr.nodes, nullptr, &node_idx, &e, ctx);
|
||||
if (status.ok() && node_idx + 1 != texpr.nodes.size()) {
|
||||
status = Status::InternalError(
|
||||
"Expression tree only partially reconstructed. Not all thrift nodes were used.");
|
||||
@ -280,20 +280,20 @@ Status Expr::create_tree_from_thrift(ObjectPool* pool, const std::vector<TExprNo
|
||||
return Status::InternalError("Failed to reconstruct expression tree from thrift.");
|
||||
}
|
||||
int num_children = nodes[*node_idx].num_children;
|
||||
Expr* expr = NULL;
|
||||
Expr* expr = nullptr;
|
||||
RETURN_IF_ERROR(create_expr(pool, nodes[*node_idx], &expr));
|
||||
DCHECK(expr != NULL);
|
||||
if (parent != NULL) {
|
||||
DCHECK(expr != nullptr);
|
||||
if (parent != nullptr) {
|
||||
parent->add_child(expr);
|
||||
} else {
|
||||
DCHECK(root_expr != NULL);
|
||||
DCHECK(ctx != NULL);
|
||||
DCHECK(root_expr != nullptr);
|
||||
DCHECK(ctx != nullptr);
|
||||
*root_expr = expr;
|
||||
*ctx = pool->add(new ExprContext(expr));
|
||||
}
|
||||
for (int i = 0; i < num_children; i++) {
|
||||
*node_idx += 1;
|
||||
RETURN_IF_ERROR(create_tree_from_thrift(pool, nodes, expr, node_idx, NULL, NULL));
|
||||
RETURN_IF_ERROR(create_tree_from_thrift(pool, nodes, expr, node_idx, nullptr, nullptr));
|
||||
// we are expecting a child, but have used all nodes
|
||||
// this means we have been given a bad tree and must fail
|
||||
if (*node_idx >= nodes.size()) {
|
||||
@ -459,8 +459,8 @@ int Expr::compute_results_layout(const std::vector<Expr*>& exprs, std::vector<in
|
||||
for (int i = 0; i < exprs.size(); ++i) {
|
||||
data[i].expr_idx = i;
|
||||
|
||||
if (exprs[i]->type().type == TYPE_CHAR || exprs[i]->type().type == TYPE_VARCHAR
|
||||
|| exprs[i]->type().type == TYPE_STRING) {
|
||||
if (exprs[i]->type().type == TYPE_CHAR || exprs[i]->type().type == TYPE_VARCHAR ||
|
||||
exprs[i]->type().type == TYPE_STRING) {
|
||||
data[i].byte_size = 16;
|
||||
data[i].variable_length = true;
|
||||
} else {
|
||||
@ -564,9 +564,9 @@ void Expr::close(RuntimeState* state, ExprContext* context,
|
||||
#if 0
|
||||
if (scope == FunctionContext::FRAGMENT_LOCAL) {
|
||||
// This is the final, non-cloned context to close. Clean up the whole Expr.
|
||||
if (cache_entry_ != NULL) {
|
||||
if (cache_entry_ != nullptr) {
|
||||
LibCache::instance()->DecrementUseCount(cache_entry_);
|
||||
cache_entry_ = NULL;
|
||||
cache_entry_ = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -574,7 +574,7 @@ void Expr::close(RuntimeState* state, ExprContext* context,
|
||||
|
||||
Status Expr::clone_if_not_exists(const std::vector<ExprContext*>& ctxs, RuntimeState* state,
|
||||
std::vector<ExprContext*>* new_ctxs) {
|
||||
DCHECK(new_ctxs != NULL);
|
||||
DCHECK(new_ctxs != nullptr);
|
||||
if (!new_ctxs->empty()) {
|
||||
// 'ctxs' was already cloned into '*new_ctxs', nothing to do.
|
||||
DCHECK_EQ(new_ctxs->size(), ctxs.size());
|
||||
@ -665,43 +665,43 @@ const Expr* Expr::expr_without_cast(const Expr* expr) {
|
||||
|
||||
doris_udf::AnyVal* Expr::get_const_val(ExprContext* context) {
|
||||
if (!is_constant()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (_constant_val.get() != NULL) {
|
||||
if (_constant_val.get() != nullptr) {
|
||||
return _constant_val.get();
|
||||
}
|
||||
switch (_type.type) {
|
||||
case TYPE_BOOLEAN: {
|
||||
_constant_val.reset(new BooleanVal(get_boolean_val(context, NULL)));
|
||||
_constant_val.reset(new BooleanVal(get_boolean_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_TINYINT: {
|
||||
_constant_val.reset(new TinyIntVal(get_tiny_int_val(context, NULL)));
|
||||
_constant_val.reset(new TinyIntVal(get_tiny_int_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_SMALLINT: {
|
||||
_constant_val.reset(new SmallIntVal(get_small_int_val(context, NULL)));
|
||||
_constant_val.reset(new SmallIntVal(get_small_int_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_INT: {
|
||||
_constant_val.reset(new IntVal(get_int_val(context, NULL)));
|
||||
_constant_val.reset(new IntVal(get_int_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_BIGINT: {
|
||||
_constant_val.reset(new BigIntVal(get_big_int_val(context, NULL)));
|
||||
_constant_val.reset(new BigIntVal(get_big_int_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_LARGEINT: {
|
||||
_constant_val.reset(new LargeIntVal(get_large_int_val(context, NULL)));
|
||||
_constant_val.reset(new LargeIntVal(get_large_int_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_FLOAT: {
|
||||
_constant_val.reset(new FloatVal(get_float_val(context, NULL)));
|
||||
_constant_val.reset(new FloatVal(get_float_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_DOUBLE:
|
||||
case TYPE_TIME: {
|
||||
_constant_val.reset(new DoubleVal(get_double_val(context, NULL)));
|
||||
_constant_val.reset(new DoubleVal(get_double_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_CHAR:
|
||||
@ -709,17 +709,17 @@ doris_udf::AnyVal* Expr::get_const_val(ExprContext* context) {
|
||||
case TYPE_HLL:
|
||||
case TYPE_OBJECT:
|
||||
case TYPE_STRING: {
|
||||
_constant_val.reset(new StringVal(get_string_val(context, NULL)));
|
||||
_constant_val.reset(new StringVal(get_string_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_DATE:
|
||||
case TYPE_DATETIME: {
|
||||
_constant_val.reset(new DateTimeVal(get_datetime_val(context, NULL)));
|
||||
_constant_val.reset(new DateTimeVal(get_datetime_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_DECIMALV2: {
|
||||
_constant_val.reset(new DecimalV2Val(get_decimalv2_val(context, NULL)));
|
||||
_constant_val.reset(new DecimalV2Val(get_decimalv2_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
case TYPE_NULL: {
|
||||
@ -727,13 +727,13 @@ doris_udf::AnyVal* Expr::get_const_val(ExprContext* context) {
|
||||
break;
|
||||
}
|
||||
case TYPE_ARRAY: {
|
||||
_constant_val.reset(new CollectionVal(get_array_val(context, NULL)));
|
||||
_constant_val.reset(new CollectionVal(get_array_val(context, nullptr)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DCHECK(false) << "Type not implemented: " << type();
|
||||
}
|
||||
DCHECK(_constant_val.get() != NULL);
|
||||
DCHECK(_constant_val.get() != nullptr);
|
||||
return _constant_val.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user