Repository navigation
[Vectorization] support SegmentIterator vectorization - #7613
Conversation
|
i will review this PR later |
| virtual void evaluate_vec(vectorized::IColumn& column, uint16_t size, bool* flags) const {}; | ||
| uint32_t column_id() const { return _column_id; } | ||
|
|
||
| virtual bool is_in_predicate() { return false; } |
There was a problem hiding this comment.
is_in_predicate should be declared as const because it seems read-only
| vectorized::IColumn::MutablePtr Schema::get_predicate_column_ptr(FieldType type) { | ||
| switch (type) { | ||
| case OLAP_FIELD_TYPE_TINYINT: | ||
| return doris::vectorized::PredicateColumnType<doris::vectorized::Int8>::create(); |
There was a problem hiding this comment.
too much switch type case xxx, i have seen many times such functions, building a mapping may a good choice.
template technology may be useful to satisfied this need
There was a problem hiding this comment.
This method could just be called once, branch doesn't matter.
And in the actual performance test, this won't cost too much time.
| dst_col_ptr = nullable_column->get_nested_column_ptr().get(); | ||
|
|
||
| // fill null bitmap here, not null; | ||
| for (int j = begin; j < end; j++) { |
There was a problem hiding this comment.
consider using add_num_element instead
| virtual void replace_column_data_default(size_t self_row = 0) = 0; | ||
|
|
||
| bool is_date_type() { return is_date; } | ||
| virtual bool is_date_type() { return is_date; } |
There was a problem hiding this comment.
is_xxx should be marked as const
There was a problem hiding this comment.
This is a temporary implementation, this method would be removed later.
| return false; | ||
| } | ||
|
|
||
| bool is_date_type() override { return get_nested_column().is_date_type(); } |
There was a problem hiding this comment.
the same problem to above
|
i need spend more time to check this PR carefully, so give me more time, i will compete in a few days! |
| if (len != 0) { | ||
| BitmapValue value; | ||
| value.deserialize(&_data[start_offset]); | ||
| *pvalue = std::move(value); |
There was a problem hiding this comment.
why not use pvalue->deserialize() directly?
There was a problem hiding this comment.
I'm not sure, I refer the logic in RowBlockV2::_copy_data_to_column.
| bool is_mem_reuse = block->mem_reuse(); | ||
| SCOPED_RAW_TIMER(&_opts.stats->block_load_ns); | ||
| if (UNLIKELY(!_inited)) { | ||
| RETURN_IF_ERROR(_init(true)); |
There was a problem hiding this comment.
conditionly init is not a good practice although this usage is applied frequently
separating init from next_batch is more reasonable because these two methods do absolutely different things
There was a problem hiding this comment.
This method could only be called once in a segment_iterator's lifecycle, this is not frequently at all.
Add a args just for code reuse, you can see the method _init 's implementation.
There was a problem hiding this comment.
i know your meaning, i am talking from the reasonableness
too many usages in doris, but i still think should separate these two functions
i modified this similar usage in BlockReader
| for (int i = block->columns() - 1; i >= column_to_keep; i--) { | ||
| block->erase(i); | ||
| } | ||
| block->clear_column_data(); |
There was a problem hiding this comment.
use block->clear_column_data(_schema.num_column_ids()) is better!
There was a problem hiding this comment.
The column of block has be dealt in SegmentIterator::_init_current_block.
So here block should only contain return columns.
There was a problem hiding this comment.
check clear_column_data(with arg) 's implement, i think it provided what you want
| return Status::OK(); | ||
| } | ||
|
|
||
| void SegmentIterator::_init_current_block(vectorized::Block* block, std::vector<vectorized::MutableColumnPtr>& current_columns) { |
There was a problem hiding this comment.
why pass member data _current_return_columns as member function‘s argument?
why not use _current_return_columns in _init_current_block directly?
| } | ||
| } | ||
| // not sure whether block is clear before enter segmentIter, so clear it here. | ||
| if (is_mem_reuse) { |
There was a problem hiding this comment.
it' s not a good idea to clear here. think who should take responsibility for clear job.
in another words, we should wrap the reuse logic rather than exposed everywhere
There was a problem hiding this comment.
You are right, but this is just a defensive strategy.
What you talk about should be considered after this PR merged, that's not this PR wish to solve.
9088814 to
79dfd8a
Compare
Proposed changes
Support SegmentIterator vectorization, see #7614
Types of changes
What types of changes does your code introduce to Doris?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...