Skip to content

Commit

Permalink
minor: Remove unused create_row_hashes (#12083)
Browse files Browse the repository at this point in the history
* remove redundant loop

* remove redundant loop

* remove unused methods
  • Loading branch information
andygrove committed Aug 21, 2024
1 parent 6786f15 commit 846befb
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions datafusion/common/src/hash_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::sync::Arc;
use ahash::RandomState;
use arrow::array::*;
use arrow::datatypes::*;
use arrow::row::Rows;
#[cfg(not(feature = "force_hash_collisions"))]
use arrow::{downcast_dictionary_array, downcast_primitive_array};
use arrow_buffer::IntervalDayTime;
Expand Down Expand Up @@ -363,38 +362,6 @@ pub fn create_hashes<'a>(
Ok(hashes_buffer)
}

/// Test version of `create_row_hashes` that produces the same value for
/// all hashes (to test collisions)
///
/// See comments on `hashes_buffer` for more details
#[cfg(feature = "force_hash_collisions")]
pub fn create_row_hashes<'a>(
_rows: &[Vec<u8>],
_random_state: &RandomState,
hashes_buffer: &'a mut Vec<u64>,
) -> Result<&'a mut Vec<u64>> {
for hash in hashes_buffer.iter_mut() {
*hash = 0
}
Ok(hashes_buffer)
}

/// Creates hash values for every row, based on their raw bytes.
#[cfg(not(feature = "force_hash_collisions"))]
pub fn create_row_hashes<'a>(
rows: &[Vec<u8>],
random_state: &RandomState,
hashes_buffer: &'a mut Vec<u64>,
) -> Result<&'a mut Vec<u64>> {
for hash in hashes_buffer.iter_mut() {
*hash = 0
}
for (i, hash) in hashes_buffer.iter_mut().enumerate() {
*hash = random_state.hash_one(&rows[i]);
}
Ok(hashes_buffer)
}

/// Creates hash values for every row, based on the values in the
/// columns.
///
Expand Down Expand Up @@ -468,38 +435,6 @@ pub fn create_hashes<'a>(
Ok(hashes_buffer)
}

/// Test version of `create_row_hashes_v2` that produces the same value for
/// all hashes (to test collisions)
///
/// See comments on `hashes_buffer` for more details
#[cfg(feature = "force_hash_collisions")]
pub fn create_row_hashes_v2<'a>(
_rows: &Rows,
_random_state: &RandomState,
hashes_buffer: &'a mut Vec<u64>,
) -> Result<&'a mut Vec<u64>> {
for hash in hashes_buffer.iter_mut() {
*hash = 0
}
Ok(hashes_buffer)
}

/// Creates hash values for every row, based on their raw bytes.
#[cfg(not(feature = "force_hash_collisions"))]
pub fn create_row_hashes_v2<'a>(
rows: &Rows,
random_state: &RandomState,
hashes_buffer: &'a mut Vec<u64>,
) -> Result<&'a mut Vec<u64>> {
for hash in hashes_buffer.iter_mut() {
*hash = 0
}
for (i, hash) in hashes_buffer.iter_mut().enumerate() {
*hash = random_state.hash_one(rows.row(i));
}
Ok(hashes_buffer)
}

#[cfg(test)]
mod tests {
use std::sync::Arc;
Expand Down

0 comments on commit 846befb

Please sign in to comment.