-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](schema scanner)change schema_scanner::get_next_row to get_next_block #15718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
|
|
||
| virtual Status start(RuntimeState* state); | ||
| virtual Status get_next_row(Tuple* tuple, MemPool* pool, bool* eos); | ||
| virtual Status get_next_block(vectorized::Block* block, bool* eos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override]
| virtual Status get_next_block(vectorized::Block* block, bool* eos); | |
| Status get_next_block(vectorized::Block* block, bool* eos) override; |
| if (!slot_desc->is_materialized()) { | ||
| continue; | ||
| if (mem_reuse) { | ||
| columns[i] = std::move(*block->get_by_position(i).column).mutate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: std::move of the const expression has no effect; remove std::move() [performance-move-const-arg]
| columns[i] = std::move(*block->get_by_position(i).column).mutate(); | |
| columns[i] = *block->get_by_position(i).column.mutate(); |
| DCHECK(block->rows() == 0); | ||
| if (_schema_scanner->type() == TSchemaTableType::SCH_TABLES) { | ||
| do { | ||
| bool mem_reuse = block->mem_reuse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not use mem reuse here, just call block->clear() to clear all columns in block and then reinsert columns.
| sizeof(_s_tbls_columns) / sizeof(SchemaScanner::ColumnDesc)), | ||
| _db_index(0), | ||
| _table_index(0) {} | ||
| _table_index(0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_table_index is useless
|
TeamCity pipeline, clickbench performance test result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
| SchemaTablesScanner(); | ||
| virtual ~SchemaTablesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| virtual ~SchemaTablesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); | ||
| virtual Status get_next_row(Tuple* tuple, MemPool* pool, bool* eos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'get_next_row' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status get_next_row(Tuple* tuple, MemPool* pool, bool* eos);
^be/src/exec/schema_scanner.h:85: overridden virtual function is here
virtual Status get_next_row(Tuple* tuple, MemPool* pool, bool* eos);
^|
|
||
| Status SchemaTablesScanner::fill_one_row(vectorized::Block* block) { | ||
| const TTableStatus& tbl_status = _table_result.tables[_table_index]; | ||
| Status SchemaTablesScanner::fill_block_imp(vectorized::Block* block) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fill_block_impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
| public: | ||
| SchemaColumnsScanner(); | ||
| virtual ~SchemaColumnsScanner(); | ||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| public: | ||
| SchemaDummyScanner(); | ||
| virtual ~SchemaDummyScanner(); | ||
| virtual Status start(RuntimeState* state = nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state = nullptr);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaFilesScanner(); | ||
| virtual ~SchemaFilesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaPartitionsScanner(); | ||
| virtual ~SchemaPartitionsScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaSchemaPrivilegesScanner(); | ||
| virtual ~SchemaSchemaPrivilegesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaSchemataScanner(); | ||
| virtual ~SchemaSchemataScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaTablePrivilegesScanner(); | ||
| virtual ~SchemaTablePrivilegesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaUserPrivilegesScanner(); | ||
| virtual ~SchemaUserPrivilegesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaVariablesScanner(TVarType::type type); | ||
| virtual ~SchemaVariablesScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^| SchemaViewsScanner(); | ||
| virtual ~SchemaViewsScanner(); | ||
|
|
||
| virtual Status start(RuntimeState* state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'start' overrides a member function but is not marked 'override' [clang-diagnostic-inconsistent-missing-override]
virtual Status start(RuntimeState* state);
^be/src/exec/schema_scanner.h:84: overridden virtual function is here
virtual Status start(RuntimeState* state);
^
be/src/exec/schema_scan_node.cpp
Outdated
| } | ||
|
|
||
| RETURN_IF_ERROR(_schema_scanner->get_next_row(_src_tuple, _tuple_pool.get(), &scanner_eos)); | ||
| // RETURN_IF_ERROR(_schema_scanner->get_next_row(_src_tuple, _tuple_pool.get(), &scanner_eos)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just remove the code
| return Status::InternalError("input pointer is nullptr."); | ||
| } | ||
|
|
||
| *eos = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rowsets 这个表不一定可以一个block 一下子装进去的,可能有10000000个rowset
|
clang-tidy review says "All clean, LGTM! 👍" |
be/src/exec/schema_scanner.cpp
Outdated
| if (!block->has(slot_desc->col_name())) { | ||
| return Status::OK(); | ||
| } | ||
| vectorized::IColumn* col_ptr = const_cast<vectorized::IColumn*>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里你不要直接使用裸指针, 尽量使用 ColumnPtr 这种类似智能指针的结构
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
be/src/exec/schema_scanner.cpp
Outdated
| return Status::OK(); | ||
| } | ||
| vectorized::MutableColumnPtr column_ptr = | ||
| std::move(*block->get_by_name(slot_desc->col_name()).column).mutate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: std::move of the const expression has no effect; remove std::move() [performance-move-const-arg]
| std::move(*block->get_by_name(slot_desc->col_name()).column).mutate(); | |
| *block->get_by_name(slot_desc->col_name()).column.mutate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
be/src/exec/schema_scanner.cpp
Outdated
| return Status::OK(); | ||
| } | ||
| vectorized::MutableColumnPtr column_ptr = | ||
| std::move(*block->get_by_name(slot_desc->col_name()).column).assume_mutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: std::move of the const expression has no effect; remove std::move() [performance-move-const-arg]
| std::move(*block->get_by_name(slot_desc->col_name()).column).assume_mutable(); | |
| *block->get_by_name(slot_desc->col_name()).column.assume_mutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
| return Status::OK(); | ||
| } | ||
| vectorized::MutableColumnPtr column_ptr = | ||
| std::move(*block->get_by_name(col_desc.name).column).assume_mutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: std::move of the const expression has no effect; remove std::move() [performance-move-const-arg]
| std::move(*block->get_by_name(col_desc.name).column).assume_mutable(); | |
| *block->get_by_name(col_desc.name).column.assume_mutable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
| _columns = nullptr; | ||
| } | ||
| } | ||
| SchemaScanner::~SchemaScanner() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
| SchemaScanner::~SchemaScanner() {} | |
| SchemaScanner::~SchemaScanner() = default; |
| delete[] reinterpret_cast<char*>(_dest_single_tuple); | ||
| _dest_single_tuple = nullptr; | ||
| } | ||
| VSchemaScanNode::~VSchemaScanNode() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
| VSchemaScanNode::~VSchemaScanNode() {} | |
| VSchemaScanNode::~VSchemaScanNode() = default; |
yiguolei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Proposed changes
Issue Number: close #xxx
Problem summary
delete schema scanner::get_next_row,change to get_to_block
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...