Skip to content

Commit

Permalink
update hash
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangstar333 committed Mar 12, 2024
1 parent ec879df commit 80e5451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
12 changes: 3 additions & 9 deletions be/src/pipeline/exec/exchange_sink_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,16 +478,10 @@ Status ExchangeSinkOperatorX::sink(RuntimeState* state, vectorized::Block* block

const auto& row_ids = local_state._row_part_tablet_ids[0].row_ids;
const auto& tablet_ids = local_state._row_part_tablet_ids[0].tablet_ids;
auto select_rows = row_ids.size();
std::vector<uint32_t> crc_hash_vals(select_rows);
auto* __restrict crc_hashes = crc_hash_vals.data();
for (size_t i = 0; i < select_rows; i++) {
crc_hashes[i] =
HashUtil::zlib_crc_hash(&tablet_ids[i], sizeof(int64), crc_hashes[i]);
}
for (int idx = 0; idx < select_rows; ++idx) {
for (int idx = 0; idx < row_ids.size(); ++idx) {
const auto& row = row_ids[idx];
const auto& tablet_id_hash = crc_hash_vals[idx];
const auto& tablet_id_hash =
HashUtil::zlib_crc_hash(&tablet_ids[idx], sizeof(int64), 0);
channel2rows[tablet_id_hash % num_channels].emplace_back(row);
}
}
Expand Down
12 changes: 3 additions & 9 deletions be/src/vec/sink/vdata_stream_sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,16 +703,10 @@ Status VDataStreamSender::send(RuntimeState* state, Block* block, bool eos) {

const auto& row_ids = _row_part_tablet_ids[0].row_ids;
const auto& tablet_ids = _row_part_tablet_ids[0].tablet_ids;
auto select_rows = row_ids.size();
std::vector<uint32_t> crc_hash_vals(select_rows);
auto* __restrict crc_hashes = crc_hash_vals.data();
for (size_t i = 0; i < select_rows; i++) {
crc_hashes[i] =
HashUtil::zlib_crc_hash(&tablet_ids[i], sizeof(int64), crc_hashes[i]);
}
for (int idx = 0; idx < select_rows; ++idx) {
for (int idx = 0; idx < row_ids.size(); ++idx) {
const auto& row = row_ids[idx];
const auto& tablet_id_hash = crc_hash_vals[idx];
const auto& tablet_id_hash =
HashUtil::zlib_crc_hash(&tablet_ids[idx], sizeof(int64), 0);
channel2rows[tablet_id_hash % num_channels].emplace_back(row);
}
}
Expand Down

0 comments on commit 80e5451

Please sign in to comment.