This is an automated email from the ASF dual-hosted git repository. caiconghui pushed a commit to branch tablet_index in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/tablet_index by this push: new b5175a1883a do some small improvement b5175a1883a is described below commit b5175a1883a2efa0bb3b6545605677efd25e4991 Author: caiconghui1 <caicongh...@jd.com> AuthorDate: Mon Nov 13 11:03:17 2023 +0800 do some small improvement --- be/src/exec/tablet_info.h | 8 ++++---- be/src/vec/sink/vtablet_finder.cpp | 22 +++++++--------------- be/src/vec/sink/vtablet_finder.h | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/be/src/exec/tablet_info.h b/be/src/exec/tablet_info.h index f4daf2ca64f..fdcdb6d5410 100644 --- a/be/src/exec/tablet_info.h +++ b/be/src/exec/tablet_info.h @@ -187,7 +187,7 @@ public: std::vector<VOlapTablePartition*>& partitions, std::vector<uint32_t>& tablet_indexes /*result*/, /*TODO: check if flat hash map will be better*/ - std::map<int64_t, int64_t>* partition_tablets_buffer = nullptr) const { + std::map<VOlapTablePartition*, int64_t>* partition_tablets_buffer = nullptr) const { std::function<uint32_t(vectorized::Block*, uint32_t, const VOlapTablePartition&)> compute_function; if (!_distributed_slot_locs.empty()) { @@ -225,13 +225,13 @@ public: } } else { // use buffer for (auto index : indexes) { - auto& partition_id = partitions[index]->id; - if (auto it = partition_tablets_buffer->find(partition_id); + auto partition = partitions[index]; + if (auto it = partition_tablets_buffer->find(partition); it != partition_tablets_buffer->end()) { tablet_indexes[index] = it->second; // tablet } else { // compute and save in buffer - (*partition_tablets_buffer)[partition_id] = tablet_indexes[index] = + (*partition_tablets_buffer)[partition] = tablet_indexes[index] = compute_function(block, index, *partitions[index]); } } diff --git a/be/src/vec/sink/vtablet_finder.cpp b/be/src/vec/sink/vtablet_finder.cpp index fc169f3a626..f268a4aa9f1 100644 --- a/be/src/vec/sink/vtablet_finder.cpp +++ b/be/src/vec/sink/vtablet_finder.cpp @@ -99,21 +99,13 @@ Status OlapTabletFinder::find_tablets(RuntimeState* state, Block* block, int row _vpartition->find_tablets(block, qualified_rows, partitions, tablet_index, &_partition_to_tablet_map); if (_find_tablet_mode == FindTabletMode::FIND_TABLET_EVERY_BATCH) { - for (auto row_index : qualified_rows) { - auto partition = partitions[row_index]; - if (_partition_to_tablet_map.find(partition->id) != - _partition_to_tablet_map.end()) { - // do round-robin for next batch - if (partition->load_tablet_idx != -1) { - partition->load_tablet_idx++; - } - _partition_to_tablet_map.erase(partition->id); - } else { - if (_partition_to_tablet_map.empty()) { - break; - } - } - } + for (auto it : _partition_to_tablet_map) { + // do round-robin for next batch + if (it.first->load_tablet_idx != -1) { + it.first->load_tablet_idx++; + } + } + _partition_to_tablet_map.clear(); } } diff --git a/be/src/vec/sink/vtablet_finder.h b/be/src/vec/sink/vtablet_finder.h index b44fb4f1fea..bccdc39a066 100644 --- a/be/src/vec/sink/vtablet_finder.h +++ b/be/src/vec/sink/vtablet_finder.h @@ -66,7 +66,7 @@ public: private: VOlapTablePartitionParam* _vpartition; FindTabletMode _find_tablet_mode; - std::map<int64_t, int64_t> _partition_to_tablet_map; + std::map<VOlapTablePartition*, int64_t> _partition_to_tablet_map; vectorized::flat_hash_set<int64_t> _partition_ids; int64_t _num_filtered_rows = 0; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org