Skip to content

Commit

Permalink
refractor for improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
cambyzju committed Oct 20, 2022
1 parent 7896f60 commit 4de58b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 2 additions & 6 deletions be/src/olap/rowset/segment_v2/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,13 +1080,9 @@ Status SegmentIterator::next_batch(vectorized::Block* block) {
for (size_t i = 0; i < _schema.num_column_ids(); i++) {
auto cid = _schema.column_id(i);
auto column_desc = _schema.column(cid);
if (column_desc->type() == OLAP_FIELD_TYPE_ARRAY) {
if (_is_pred_column[cid]) {
_current_return_columns[cid] =
Schema::get_data_type_ptr(*column_desc)->create_column();
_current_return_columns[cid]->reserve(_opts.block_row_max);
} else if (_is_pred_column[cid]) {
_current_return_columns[cid] = Schema::get_predicate_column_nullable_ptr(
column_desc->type(), column_desc->is_nullable());
Schema::get_predicate_column_nullable_ptr(*column_desc);
_current_return_columns[cid]->reserve(_opts.block_row_max);
} else if (i >= block->columns()) {
// if i >= block->columns means the column and not the pred_column means `column i` is
Expand Down
11 changes: 7 additions & 4 deletions be/src/olap/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ vectorized::DataTypePtr Schema::get_data_type_ptr(const Field& field) {
return vectorized::DataTypeFactory::instance().create_data_type(field);
}

vectorized::IColumn::MutablePtr Schema::get_predicate_column_nullable_ptr(FieldType type,
bool is_null) {
vectorized::IColumn::MutablePtr ptr = Schema::get_predicate_column_ptr(type);
if (is_null) {
vectorized::IColumn::MutablePtr Schema::get_predicate_column_nullable_ptr(const Field& field) {
if (UNLIKELY(field.type() == OLAP_FIELD_TYPE_ARRAY)) {
return get_data_type_ptr(field)->create_column();
}

vectorized::IColumn::MutablePtr ptr = Schema::get_predicate_column_ptr(field.type());
if (field.is_nullable()) {
return doris::vectorized::ColumnNullable::create(std::move(ptr),
doris::vectorized::ColumnUInt8::create());
}
Expand Down
3 changes: 1 addition & 2 deletions be/src/olap/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ class Schema {

static vectorized::IColumn::MutablePtr get_predicate_column_ptr(FieldType type);

static vectorized::IColumn::MutablePtr get_predicate_column_nullable_ptr(FieldType type,
bool is_null = false);
static vectorized::IColumn::MutablePtr get_predicate_column_nullable_ptr(const Field& field);

const std::vector<Field*>& columns() const { return _cols; }

Expand Down

0 comments on commit 4de58b0

Please sign in to comment.