[CodeFormat] Clang-format cpp sources (#4965)

Clang-format all c++ source files.
This commit is contained in:
sduzh
2020-11-28 18:36:49 +08:00
committed by GitHub
parent f944bf4d44
commit 6fedf5881b
1331 changed files with 62548 additions and 68514 deletions

View File

@ -18,31 +18,28 @@
#include "exec/repeat_node.h"
#include "exprs/expr.h"
#include "gutil/strings/join.h"
#include "runtime/raw_value.h"
#include "runtime/row_batch.h"
#include "runtime/runtime_state.h"
#include "util/runtime_profile.h"
#include "gutil/strings/join.h"
namespace doris {
RepeatNode::RepeatNode(ObjectPool* pool, const TPlanNode& tnode,
const DescriptorTbl& descs)
: ExecNode(pool, tnode, descs),
_slot_id_set_list(tnode.repeat_node.slot_id_set_list),
_all_slot_ids(tnode.repeat_node.all_slot_ids),
_repeat_id_list(tnode.repeat_node.repeat_id_list),
_grouping_list(tnode.repeat_node.grouping_list),
_output_tuple_id(tnode.repeat_node.output_tuple_id),
_tuple_desc(nullptr),
_child_row_batch(nullptr),
_child_eos(false),
_repeat_id_idx(0),
_runtime_state(nullptr) {
}
RepeatNode::RepeatNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl& descs)
: ExecNode(pool, tnode, descs),
_slot_id_set_list(tnode.repeat_node.slot_id_set_list),
_all_slot_ids(tnode.repeat_node.all_slot_ids),
_repeat_id_list(tnode.repeat_node.repeat_id_list),
_grouping_list(tnode.repeat_node.grouping_list),
_output_tuple_id(tnode.repeat_node.output_tuple_id),
_tuple_desc(nullptr),
_child_row_batch(nullptr),
_child_eos(false),
_repeat_id_idx(0),
_runtime_state(nullptr) {}
RepeatNode::~RepeatNode() {
}
RepeatNode::~RepeatNode() {}
Status RepeatNode::prepare(RuntimeState* state) {
SCOPED_TIMER(_runtime_profile->total_time_counter());
@ -70,16 +67,17 @@ Status RepeatNode::open(RuntimeState* state) {
* e.g. _repeat_id_list = [0, 3, 1, 2], _repeat_id_idx = 2, _grouping_list [[0, 3, 1, 2], [0, 1, 1, 0]],
* row_batch tuple 0 ['a', 'b', 1] -> [['a', null, 1] tuple 1 [1, 1]]
*/
Status RepeatNode::get_repeated_batch(
RowBatch* child_row_batch, int repeat_id_idx, RowBatch* row_batch) {
Status RepeatNode::get_repeated_batch(RowBatch* child_row_batch, int repeat_id_idx,
RowBatch* row_batch) {
DCHECK(child_row_batch != nullptr);
DCHECK_EQ(row_batch->num_rows(), 0);
// Fill all slots according to child
MemPool* tuple_pool = row_batch->tuple_data_pool();
const std::vector<TupleDescriptor*>& src_tuple_descs = child_row_batch->row_desc().tuple_descriptors();
const std::vector<TupleDescriptor*>& dst_tuple_descs = row_batch->row_desc().tuple_descriptors();
const std::vector<TupleDescriptor*>& src_tuple_descs =
child_row_batch->row_desc().tuple_descriptors();
const std::vector<TupleDescriptor*>& dst_tuple_descs =
row_batch->row_desc().tuple_descriptors();
std::vector<Tuple*> dst_tuples(src_tuple_descs.size(), nullptr);
for (int i = 0; i < child_row_batch->num_rows(); ++i) {
int row_idx = row_batch->add_row();
@ -88,7 +86,8 @@ Status RepeatNode::get_repeated_batch(
auto src_it = src_tuple_descs.begin();
auto dst_it = dst_tuple_descs.begin();
for (int j = 0; src_it != src_tuple_descs.end() && dst_it != dst_tuple_descs.end(); ++src_it, ++dst_it, ++j) {
for (int j = 0; src_it != src_tuple_descs.end() && dst_it != dst_tuple_descs.end();
++src_it, ++dst_it, ++j) {
Tuple* src_tuple = src_row->get_tuple(j);
if (src_tuple == NULL) {
continue;
@ -126,32 +125,33 @@ Status RepeatNode::get_repeated_batch(
}
row_batch->commit_last_row();
}
Tuple *tuple = nullptr;
Tuple* tuple = nullptr;
// Fill grouping ID to tuple
for (int i = 0; i < child_row_batch->num_rows(); ++i) {
int row_idx = i;
TupleRow *row = row_batch->get_row(row_idx);
TupleRow* row = row_batch->get_row(row_idx);
if (tuple == nullptr) {
int size = row_batch->capacity() * _tuple_desc->byte_size();
void *tuple_buffer = tuple_pool->allocate(size);
void* tuple_buffer = tuple_pool->allocate(size);
if (tuple_buffer == nullptr) {
return Status::InternalError("Allocate memory for row batch failed.");
}
tuple = reinterpret_cast<Tuple *>(tuple_buffer);
tuple = reinterpret_cast<Tuple*>(tuple_buffer);
} else {
char *new_tuple = reinterpret_cast<char *>(tuple);
char* new_tuple = reinterpret_cast<char*>(tuple);
new_tuple += _tuple_desc->byte_size();
tuple = reinterpret_cast<Tuple *>(new_tuple);
tuple = reinterpret_cast<Tuple*>(new_tuple);
}
row->set_tuple(src_tuple_descs.size(), tuple);
memset(tuple, 0, _tuple_desc->num_null_bytes());
for(size_t slot_idx = 0; slot_idx < _grouping_list.size(); ++slot_idx) {
for (size_t slot_idx = 0; slot_idx < _grouping_list.size(); ++slot_idx) {
int64_t val = _grouping_list[slot_idx][repeat_id_idx];
DCHECK_LT(slot_idx, _tuple_desc->slots().size()) << "TupleDescriptor: " << _tuple_desc->debug_string();
const SlotDescriptor *slot_desc = _tuple_desc->slots()[slot_idx];
DCHECK_LT(slot_idx, _tuple_desc->slots().size())
<< "TupleDescriptor: " << _tuple_desc->debug_string();
const SlotDescriptor* slot_desc = _tuple_desc->slots()[slot_idx];
tuple->set_not_null(slot_desc->null_indicator_offset());
RawValue::write(&val, tuple, slot_desc, tuple_pool);
}
@ -175,7 +175,7 @@ Status RepeatNode::get_next(RuntimeState* state, RowBatch* row_batch, bool* eos)
}
_child_row_batch.reset(
new RowBatch(child(0)->row_desc(), state->batch_size(), mem_tracker().get()));
new RowBatch(child(0)->row_desc(), state->batch_size(), mem_tracker().get()));
RETURN_IF_ERROR(child(0)->get_next(state, _child_row_batch.get(), &_child_eos));
if (_child_row_batch->num_rows() <= 0) {
@ -213,7 +213,7 @@ void RepeatNode::debug_string(int indentation_level, std::stringstream* out) con
*out << "repeat pattern: [" << JoinElements(_repeat_id_list, ",") << "]\n";
*out << "add " << _grouping_list.size() << " columns. \n";
*out << "added column values: ";
for (const std::vector<int64_t> &v : _grouping_list ){
for (const std::vector<int64_t>& v : _grouping_list) {
*out << "[" << JoinElements(v, ",") << "] ";
}
*out << "\n";
@ -221,4 +221,4 @@ void RepeatNode::debug_string(int indentation_level, std::stringstream* out) con
*out << ")";
}
}
} // namespace doris