superdiaodiao commented on code in PR #49317: URL: https://github.com/apache/doris/pull/49317#discussion_r2020168691
########## be/src/exec/schema_scanner/schema_tablets_scanner.cpp: ########## Review Comment: In the `Status SchemaTabletsScanner::_fill_block_impl(vectorized::Block* block){}`, you can add a lambda function like: ``` auto fill_column = [&](int column_index, auto data_extractor) { using ValueType = std::remove_reference_t<decltype(data_extractor(_tablets[0]))>; std::vector<ValueType> srcs(fill_tablets_num); for (size_t i = 0; i < fill_tablets_num; ++i) { TabletSharedPtr tablet = _tablets[fill_idx_begin + i]; srcs[i] = data_extractor(tablet); datas[i] = &srcs[i]; } return fill_dest_column_for_range(block, column_index, datas); }; ``` Then you could call it to make the code more concise like: ``` RETURN_IF_ERROR(fill_column(0, [this](auto tablet) { return _backend_id; })); RETURN_IF_ERROR(fill_column(1, [](auto tablet) { return tablet->tablet_meta()->table_id(); })); ... ... ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org