Skip to content

Commit 9d1bb03

Browse files
authored
fix: overflow error in get_partition_id() (#17906)
1 parent 697506a commit 9d1bb03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_spiller.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,16 @@ impl HashJoinSpiller {
215215
} else {
216216
let mut hashes = self.get_hashes(data_block, join_type)?;
217217
for hash in hashes.iter_mut() {
218-
*hash = Self::get_partition_id(*hash as usize, partition_bits) as u64;
218+
*hash = Self::get_partition_id(*hash, partition_bits as u64);
219219
}
220220
let partition_blocks = DataBlock::scatter(data_block, &hashes, 1 << partition_bits)?;
221221
Ok(partition_blocks)
222222
}
223223
}
224224

225225
#[inline(always)]
226-
fn get_partition_id(hash: usize, bits: usize) -> usize {
227-
(hash >> (32 - bits)) & ((1 << bits) - 1)
226+
fn get_partition_id(hash: u64, bits: u64) -> u64 {
227+
(hash >> (64 - bits)) & ((1 << bits) - 1)
228228
}
229229

230230
// Get all hashes for build input data.

0 commit comments

Comments
 (0)