github-actions[bot] commented on code in PR #26432: URL: https://github.com/apache/doris/pull/26432#discussion_r1382537027
########## be/src/exec/tablet_info.h: ########## @@ -17,6 +17,7 @@ #pragma once +#include <butil/fast_rand.h> Review Comment: warning: 'butil/fast_rand.h' file not found [clang-diagnostic-error] ```cpp #include <butil/fast_rand.h> ^ ``` ########## be/src/exec/tablet_info.h: ########## @@ -162,9 +165,78 @@ int64_t version() const { return _t_param.version; } // return true if we found this block_row in partition - bool find_partition(BlockRow* block_row, const VOlapTablePartition** partition) const; + //TODO: use virtual function to refactor it + ALWAYS_INLINE bool find_partition(vectorized::Block* block, int row, + VOlapTablePartition*& partition) const { + auto it = _is_in_partition ? _partitions_map->find(std::tuple {block, row, true}) + : _partitions_map->upper_bound(std::tuple {block, row, true}); + // for list partition it might result in default partition + if (_is_in_partition) { + partition = (it != _partitions_map->end()) ? it->second : _default_partition; + it = _partitions_map->end(); + } + if (it != _partitions_map->end() && + _part_contains(it->second, std::tuple {block, row, true})) { + partition = it->second; + } + return (partition != nullptr); + } + + ALWAYS_INLINE void find_tablets( Review Comment: warning: method 'find_tablets' can be made static [readability-convert-member-functions-to-static] ```suggestion static ALWAYS_INLINE void find_tablets( ``` be/src/exec/tablet_info.h:189: ```diff - std::map<int64_t, int64_t>* partition_tablets_buffer = nullptr) const { + std::map<int64_t, int64_t>* partition_tablets_buffer = nullptr) { ``` ########## be/src/vec/sink/vtablet_sink_v2.cpp: ########## @@ -221,20 +221,32 @@ void VOlapTableSinkV2::_build_tablet_node_mapping() { } } -void VOlapTableSinkV2::_generate_rows_for_tablet(RowsForTablet& rows_for_tablet, - const VOlapTablePartition* partition, - uint32_t tablet_index, int row_idx) { - // Generate channel payload for sinking data to each tablet - for (const auto& index : partition->indexes) { - auto tablet_id = index.tablets[tablet_index]; - if (rows_for_tablet.count(tablet_id) == 0) { - Rows rows; - rows.partition_id = partition->id; - rows.index_id = index.index_id; - rows_for_tablet.insert({tablet_id, rows}); +void VOlapTableSinkV2::_generate_rows_for_tablet( Review Comment: warning: method '_generate_rows_for_tablet' can be made static [readability-convert-member-functions-to-static] ```suggestion static void VOlapTableSinkV2::_generate_rows_for_tablet( ``` -- 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