diff --git a/fastfield_codecs/src/column.rs b/fastfield_codecs/src/column.rs index 14cdb97b0f..fc4c13b1fe 100644 --- a/fastfield_codecs/src/column.rs +++ b/fastfield_codecs/src/column.rs @@ -3,7 +3,7 @@ use std::sync::Mutex; use tantivy_bitpacker::minmax; -pub trait Column { +pub trait Column: Send + Sync { /// Return the value associated to the given idx. /// /// This accessor should return as fast as possible. @@ -80,7 +80,7 @@ impl<'a, C: Column, T: Copy + PartialOrd> Column for &'a C { } } -impl<'a, T: Copy + PartialOrd> Column for VecColumn<'a, T> { +impl<'a, T: Copy + PartialOrd + Send + Sync> Column for VecColumn<'a, T> { fn get_val(&self, position: u64) -> T { self.values[position as usize] } @@ -129,7 +129,9 @@ pub fn monotonic_map_column( ) -> impl Column where C: Column, - T: Fn(Input) -> Output, + T: Fn(Input) -> Output + Send + Sync, + Input: Send + Sync, + Output: Send + Sync, { MonotonicMappingColumn { from_column, @@ -141,7 +143,9 @@ where impl Column for MonotonicMappingColumn where C: Column, - T: Fn(Input) -> Output, + T: Fn(Input) -> Output + Send + Sync, + Input: Send + Sync, + Output: Send + Sync, { fn get_val(&self, idx: u64) -> Output { let from_val = self.from_column.get_val(idx); @@ -173,7 +177,7 @@ impl RemappedColumn where C: Column, M: Column, - T: Copy + Ord + Default, + T: Copy + Ord + Default + Send + Sync, { fn min_max(&self) -> (T, T) { if let Some((min, max)) = *self.min_max_cache.lock().unwrap() { @@ -197,7 +201,7 @@ where T: Iterator + Clone + ExactSizeIterator } impl Column for IterColumn -where T: Iterator + Clone + ExactSizeIterator +where T: Iterator + Clone + ExactSizeIterator + Send + Sync { fn get_val(&self, idx: u64) -> T::Item { self.0.clone().nth(idx as usize).unwrap() @@ -224,7 +228,7 @@ impl Column for RemappedColumn where C: Column, M: Column, - T: Copy + Ord + Default, + T: Copy + Ord + Default + Send + Sync, { fn get_val(&self, idx: u64) -> T { let old_id = self.new_to_old_id_mapping.get_val(idx); diff --git a/fastfield_codecs/src/monotonic_mapping.rs b/fastfield_codecs/src/monotonic_mapping.rs index 6b65e63e48..3466bb1510 100644 --- a/fastfield_codecs/src/monotonic_mapping.rs +++ b/fastfield_codecs/src/monotonic_mapping.rs @@ -1,4 +1,4 @@ -pub trait MonotonicallyMappableToU64: 'static + PartialOrd + Copy { +pub trait MonotonicallyMappableToU64: 'static + PartialOrd + Copy + Send + Sync { /// Converts a value to u64. /// /// Internally all fast field values are encoded as u64.