github-actions[bot] commented on code in PR #15718:
URL: https://github.com/apache/doris/pull/15718#discussion_r1064259517
##########
be/src/exec/schema_scanner/schema_tables_scanner.h:
##########
@@ -29,10 +31,13 @@ class SchemaTablesScanner : public SchemaScanner {
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);
Review Comment:
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual'
[modernize-use-override]
```suggestion
Status get_next_block(vectorized::Block* block, bool* eos) override;
```
##########
be/src/vec/exec/vschema_scan_node.cpp:
##########
@@ -258,73 +262,112 @@ Status VSchemaScanNode::get_next(RuntimeState* state,
vectorized::Block* block,
std::vector<vectorized::MutableColumnPtr> columns(_slot_num);
bool schema_eos = false;
- do {
- bool mem_reuse = block->mem_reuse();
- DCHECK(block->rows() == 0);
+ if (_schema_scanner->type() == TSchemaTableType::SCH_TABLES) {
+ do {
+ bool mem_reuse = block->mem_reuse();
+ DCHECK(block->rows() == 0);
- columns.resize(_slot_num);
- for (int i = 0; i < _slot_num; ++i) {
- if (mem_reuse) {
- columns[i] =
std::move(*block->get_by_position(i).column).mutate();
- } else {
- columns[i] =
_dest_tuple_desc->slots()[i]->get_empty_mutable_column();
+ if (!mem_reuse) {
+ for (int i = 0; i < _slot_num; ++i) {
+ int j = _index_map[i];
+ const auto slot_desc = _src_tuple_desc->slots()[j];
+
block->insert(ColumnWithTypeAndName(slot_desc->get_empty_mutable_column(),
+
slot_desc->get_data_type_ptr(),
+
slot_desc->col_name()));
+ }
}
- }
- while (true) {
- RETURN_IF_CANCELLED(state);
-
- // get all slots from schema table.
- RETURN_IF_ERROR(_schema_scanner->get_next_row(_src_single_tuple,
_tuple_pool.get(),
- &schema_eos));
- if (schema_eos) {
- *eos = true;
- break;
+
+ while (true) {
+ RETURN_IF_CANCELLED(state);
+
+ // get all slots from schema table.
+ RETURN_IF_ERROR(_schema_scanner->get_next_block(block,
&schema_eos));
+
+ if (schema_eos) {
+ *eos = true;
+ break;
+ }
+
+ if (block->rows() == state->batch_size()) {
+ break;
+ }
}
- // tuple project
- project_tuple();
+ if (block->rows()) {
+ RETURN_IF_ERROR(VExprContext::filter_block(_vconjunct_ctx_ptr,
block,
+
_dest_tuple_desc->slots().size()));
+ VLOG_ROW << "VSchemaScanNode output rows: " << block->rows();
+ }
+ } while (block->rows() == 0 && !(*eos));
+ } else {
+ do {
+ bool mem_reuse = block->mem_reuse();
+ DCHECK(block->rows() == 0);
+
+ columns.resize(_slot_num);
for (int i = 0; i < _slot_num; ++i) {
- auto slot_desc = _dest_tuple_desc->slots()[i];
- if (!slot_desc->is_materialized()) {
- continue;
+ if (mem_reuse) {
+ columns[i] =
std::move(*block->get_by_position(i).column).mutate();
Review Comment:
warning: std::move of the const expression has no effect; remove std::move()
[performance-move-const-arg]
```suggestion
columns[i] = *block->get_by_position(i).column.mutate();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]