@@ -10,6 +10,7 @@ use std::fmt::Debug;
10
10
use std:: ops:: { Range , RangeInclusive } ;
11
11
use std:: sync:: Arc ;
12
12
13
+ use downcast_rs:: DowncastSync ;
13
14
pub use monotonic_mapping:: { MonotonicallyMappableToU64 , StrictlyMonotonicFn } ;
14
15
pub use monotonic_mapping_u128:: MonotonicallyMappableToU128 ;
15
16
@@ -25,7 +26,9 @@ mod monotonic_column;
25
26
26
27
pub ( crate ) use merge:: MergedColumnValues ;
27
28
pub use stats:: ColumnStats ;
28
- pub use u128_based:: { open_u128_mapped, serialize_column_values_u128} ;
29
+ pub use u128_based:: {
30
+ open_u128_as_u64, open_u128_mapped, serialize_column_values_u128, CompactSpaceDecompressorU64 ,
31
+ } ;
29
32
pub use u64_based:: {
30
33
load_u64_based_column_values, serialize_and_load_u64_based_column_values,
31
34
serialize_u64_based_column_values, CodecType , ALL_U64_CODEC_TYPES ,
@@ -41,7 +44,7 @@ use crate::RowId;
41
44
///
42
45
/// Any methods with a default and specialized implementation need to be called in the
43
46
/// wrappers that implement the trait: Arc and MonotonicMappingColumn
44
- pub trait ColumnValues < T : PartialOrd = u64 > : Send + Sync {
47
+ pub trait ColumnValues < T : PartialOrd = u64 > : Send + Sync + DowncastSync {
45
48
/// Return the value associated with the given idx.
46
49
///
47
50
/// This accessor should return as fast as possible.
@@ -51,6 +54,11 @@ pub trait ColumnValues<T: PartialOrd = u64>: Send + Sync {
51
54
/// May panic if `idx` is greater than the column length.
52
55
fn get_val ( & self , idx : u32 ) -> T ;
53
56
57
+ /// Return the value associated with the given idx as u64 representation.
58
+ ///
59
+ /// This is useful as normalization layer between u128 and u64.
60
+ // fn u64_to_t(&self, val: u64) -> T;
61
+
54
62
/// Allows to push down multiple fetch calls, to avoid dynamic dispatch overhead.
55
63
///
56
64
/// idx and output should have the same length
@@ -139,6 +147,7 @@ pub trait ColumnValues<T: PartialOrd = u64>: Send + Sync {
139
147
Box :: new ( ( 0 ..self . num_vals ( ) ) . map ( |idx| self . get_val ( idx) ) )
140
148
}
141
149
}
150
+ downcast_rs:: impl_downcast!( sync ColumnValues <T > where T : PartialOrd ) ;
142
151
143
152
/// Empty column of values.
144
153
pub struct EmptyColumnValues ;
@@ -161,7 +170,7 @@ impl<T: PartialOrd + Default> ColumnValues<T> for EmptyColumnValues {
161
170
}
162
171
}
163
172
164
- impl < T : Copy + PartialOrd + Debug > ColumnValues < T > for Arc < dyn ColumnValues < T > > {
173
+ impl < T : Copy + PartialOrd + Debug + ' static > ColumnValues < T > for Arc < dyn ColumnValues < T > > {
165
174
#[ inline( always) ]
166
175
fn get_val ( & self , idx : u32 ) -> T {
167
176
self . as_ref ( ) . get_val ( idx)
0 commit comments