[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:
@ -89,16 +89,16 @@ bool ExecNode::RowBatchQueue::AddBatchWithTimeout(RowBatch* batch, int64_t timeo
|
||||
}
|
||||
|
||||
RowBatch* ExecNode::RowBatchQueue::GetBatch() {
|
||||
RowBatch* result = NULL;
|
||||
RowBatch* result = nullptr;
|
||||
if (blocking_get(&result)) return result;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int ExecNode::RowBatchQueue::Cleanup() {
|
||||
int num_io_buffers = 0;
|
||||
|
||||
// RowBatch* batch = NULL;
|
||||
// while ((batch = GetBatch()) != NULL) {
|
||||
// RowBatch* batch = nullptr;
|
||||
// while ((batch = GetBatch()) != nullptr) {
|
||||
// num_io_buffers += batch->num_io_buffers();
|
||||
// delete batch;
|
||||
// }
|
||||
@ -124,9 +124,9 @@ ExecNode::ExecNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl
|
||||
_debug_action(TDebugAction::WAIT),
|
||||
_limit(tnode.limit),
|
||||
_num_rows_returned(0),
|
||||
_rows_returned_counter(NULL),
|
||||
_rows_returned_rate(NULL),
|
||||
_memory_used_counter(NULL),
|
||||
_rows_returned_counter(nullptr),
|
||||
_rows_returned_rate(nullptr),
|
||||
_memory_used_counter(nullptr),
|
||||
_is_closed(false) {}
|
||||
|
||||
ExecNode::~ExecNode() {}
|
||||
@ -174,7 +174,7 @@ Status ExecNode::init(const TPlanNode& tnode, RuntimeState* state) {
|
||||
|
||||
Status ExecNode::prepare(RuntimeState* state) {
|
||||
RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::PREPARE));
|
||||
DCHECK(_runtime_profile.get() != NULL);
|
||||
DCHECK(_runtime_profile.get() != nullptr);
|
||||
_rows_returned_counter = ADD_COUNTER(_runtime_profile, "RowsReturned", TUnit::UNIT);
|
||||
_rows_returned_rate = runtime_profile()->add_derived_counter(
|
||||
ROW_THROUGHPUT_COUNTER, TUnit::UNIT_PER_SECOND,
|
||||
@ -227,7 +227,7 @@ Status ExecNode::close(RuntimeState* state) {
|
||||
_is_closed = true;
|
||||
RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::CLOSE));
|
||||
|
||||
if (_rows_returned_counter != NULL) {
|
||||
if (_rows_returned_counter != nullptr) {
|
||||
COUNTER_SET(_rows_returned_counter, _num_rows_returned);
|
||||
}
|
||||
|
||||
@ -271,12 +271,12 @@ void ExecNode::add_runtime_exec_option(const std::string& str) {
|
||||
Status ExecNode::create_tree(RuntimeState* state, ObjectPool* pool, const TPlan& plan,
|
||||
const DescriptorTbl& descs, ExecNode** root) {
|
||||
if (plan.nodes.size() == 0) {
|
||||
*root = NULL;
|
||||
*root = nullptr;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
int node_idx = 0;
|
||||
RETURN_IF_ERROR(create_tree_helper(state, pool, plan.nodes, descs, NULL, &node_idx, root));
|
||||
RETURN_IF_ERROR(create_tree_helper(state, pool, plan.nodes, descs, nullptr, &node_idx, root));
|
||||
|
||||
if (node_idx + 1 != plan.nodes.size()) {
|
||||
// TODO: print thrift msg for diagnostic purposes.
|
||||
@ -299,11 +299,11 @@ Status ExecNode::create_tree_helper(RuntimeState* state, ObjectPool* pool,
|
||||
const TPlanNode& tnode = tnodes[*node_idx];
|
||||
|
||||
int num_children = tnodes[*node_idx].num_children;
|
||||
ExecNode* node = NULL;
|
||||
ExecNode* node = nullptr;
|
||||
RETURN_IF_ERROR(create_node(state, pool, tnodes[*node_idx], descs, &node));
|
||||
|
||||
// assert(parent != NULL || (node_idx == 0 && root_expr != NULL));
|
||||
if (parent != NULL) {
|
||||
// assert(parent != nullptr || (node_idx == 0 && root_expr != nullptr));
|
||||
if (parent != nullptr) {
|
||||
parent->_children.push_back(node);
|
||||
} else {
|
||||
*root = node;
|
||||
@ -311,7 +311,7 @@ Status ExecNode::create_tree_helper(RuntimeState* state, ObjectPool* pool,
|
||||
|
||||
for (int i = 0; i < num_children; i++) {
|
||||
++*node_idx;
|
||||
RETURN_IF_ERROR(create_tree_helper(state, pool, tnodes, descs, node, node_idx, NULL));
|
||||
RETURN_IF_ERROR(create_tree_helper(state, pool, tnodes, descs, node, node_idx, nullptr));
|
||||
|
||||
// we are expecting a child, but have used all nodes
|
||||
// this means we have been given a bad tree and must fail
|
||||
@ -326,11 +326,11 @@ Status ExecNode::create_tree_helper(RuntimeState* state, ObjectPool* pool,
|
||||
// build up tree of profiles; add children >0 first, so that when we print
|
||||
// the profile, child 0 is printed last (makes the output more readable)
|
||||
for (int i = 1; i < node->_children.size(); ++i) {
|
||||
node->runtime_profile()->add_child(node->_children[i]->runtime_profile(), true, NULL);
|
||||
node->runtime_profile()->add_child(node->_children[i]->runtime_profile(), true, nullptr);
|
||||
}
|
||||
|
||||
if (!node->_children.empty()) {
|
||||
node->runtime_profile()->add_child(node->_children[0]->runtime_profile(), true, NULL);
|
||||
node->runtime_profile()->add_child(node->_children[0]->runtime_profile(), true, nullptr);
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
|
||||
Reference in New Issue
Block a user