[refactor] remove alpha rowset related code and vectorized row batch related code (#10584)

This commit is contained in:
yiguolei
2022-07-05 20:33:34 +08:00
committed by GitHub
parent 3e87960202
commit 89e56ea67f
104 changed files with 42 additions and 25388 deletions

View File

@ -26,7 +26,6 @@
#include "gen_cpp/Exprs_types.h"
#include "runtime/row_batch.h"
#include "runtime/runtime_state.h"
#include "runtime/vectorized_row_batch.h"
#include "util/debug_util.h"
namespace doris {
@ -155,91 +154,6 @@ TEST_F(BinaryOpTest, PrepareTest) {
EXPECT_TRUE(expr->prepare(runtime_state(), *row_desc()).ok());
}
TEST_F(BinaryOpTest, NormalTest) {
Expr* expr = create_expr();
EXPECT_TRUE(expr != nullptr);
EXPECT_TRUE(expr->prepare(runtime_state(), *row_desc()).ok());
int capacity = 256;
VectorizedRowBatch* vec_row_batch =
object_pool()->add(new VectorizedRowBatch(_schema, capacity));
MemPool* mem_pool = vec_row_batch->mem_pool();
int32_t* vec_data = reinterpret_cast<int32_t*>(mem_pool->allocate(sizeof(int32_t) * capacity));
vec_row_batch->column(0)->set_col_data(vec_data);
for (int i = 0; i < capacity; ++i) {
vec_data[i] = i;
}
vec_row_batch->set_size(capacity);
expr->evaluate(vec_row_batch);
EXPECT_EQ(vec_row_batch->size(), 10);
Tuple tuple;
int vv = 0;
while (vec_row_batch->get_next_tuple(&tuple,
*runtime_state()->desc_tbl().get_tuple_descriptor(0))) {
EXPECT_EQ(vv++, *reinterpret_cast<int32_t*>(tuple.get_slot(4)));
}
}
TEST_F(BinaryOpTest, SimplePerformanceTest) {
EXPECT_EQ(1, _row_desc->tuple_descriptors().size());
for (int capacity = 128; capacity <= 1024 * 128; capacity *= 2) {
Expr* expr = create_expr();
EXPECT_TRUE(expr != nullptr);
EXPECT_TRUE(expr->prepare(runtime_state(), *row_desc()).ok());
int size = 1024 * 1024 / capacity;
VectorizedRowBatch* vec_row_batches[size];
srand(time(nullptr));
for (int i = 0; i < size; ++i) {
vec_row_batches[i] = object_pool()->add(new VectorizedRowBatch(_schema, capacity));
MemPool* mem_pool = vec_row_batches[i]->mem_pool();
int32_t* vec_data =
reinterpret_cast<int32_t*>(mem_pool->allocate(sizeof(int32_t) * capacity));
vec_row_batches[i]->column(0)->set_col_data(vec_data);
for (int i = 0; i < capacity; ++i) {
vec_data[i] = rand() % 20;
}
vec_row_batches[i]->set_size(capacity);
}
RowBatch* row_batches[size];
for (int i = 0; i < size; ++i) {
row_batches[i] = object_pool()->add(new RowBatch(*row_desc(), capacity));
vec_row_batches[i]->to_row_batch(row_batches[i],
*runtime_state()->desc_tbl().get_tuple_descriptor(0));
}
MonotonicStopWatch stopwatch;
stopwatch.start();
for (int i = 0; i < size; ++i) {
expr->evaluate(vec_row_batches[i]);
}
uint64_t vec_time = stopwatch.elapsed_time();
VLOG_CRITICAL << PrettyPrinter::print(vec_time, TCounterType::TIME_NS);
stopwatch.start();
for (int i = 0; i < size; ++i) {
for (int j = 0; j < capacity; ++j) {
ExecNode::eval_conjuncts(&expr, 1, row_batches[i]->get_row(j));
}
}
uint64_t row_time = stopwatch.elapsed_time();
VLOG_CRITICAL << PrettyPrinter::print(row_time, TCounterType::TIME_NS);
VLOG_CRITICAL << "capacity: " << capacity << " multiple: " << row_time / vec_time;
}
}
} // namespace doris
/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */