From 548f63c821a31fe1b5e982dfe1c73d5ffb228885 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Thu, 17 Oct 2024 22:13:00 -0400 Subject: [PATCH] delete unusedcode for now --- encodings/dict/src/compress.rs | 97 ---------------------------------- 1 file changed, 97 deletions(-) diff --git a/encodings/dict/src/compress.rs b/encodings/dict/src/compress.rs index 85be236afe..51f86ebd03 100644 --- a/encodings/dict/src/compress.rs +++ b/encodings/dict/src/compress.rs @@ -117,103 +117,6 @@ fn lookup_bytes<'a, T: NativePType + AsPrimitive>( &bytes[begin..end] } -// Impl our own for different things here. - -// fn dict_encode_typed_view(dtype: DType, values: I) -> (PrimitiveArray, VarBinViewArray) -// where -// I: Iterator>, -// U: AsRef<[u8]>, -// { -// let (lower, _) = values.size_hint(); -// let hasher = DefaultHashBuilder::default(); -// let mut lookup_dict: HashMap = HashMap::with_hasher(()); -// -// // The codes, which will become the primitive array. -// let mut codes: Vec = Vec::with_capacity(lower); -// -// let mut views: Vec = Vec::new(); -// -// // Generate a new output buffer once we've overflowed the i32 range. -// let mut buffers: Vec> = Vec::with_capacity(1); -// let mut string_heap: Vec = Vec::with_capacity(1024); -// -// // Accumulate a temporary buffer of code bytes for fast lookups. -// -// for o_val in values { -// match o_val { -// None => codes.push(NULL_CODE), -// Some(val) => { -// let byte_ref = val.as_ref(); -// let value_hash = hasher.hash_one(byte_ref); -// let raw_entry = lookup_dict -// .raw_entry_mut() -// .from_hash(value_hash, |idx| todo!()); -// -// let code = match raw_entry { -// RawEntryMut::Occupied(o) => *o.into_key(), -// RawEntryMut::Vacant(vac) => { -// let next_code = views.len() as u64; -// let slice = val.as_ref(); -// assert!( -// slice.len() < (i32::MAX as usize), -// "cannot append a value of length >= 2^31 to VarBinViewArray" -// ); -// if slice.len() >= BinaryView::MAX_INLINED_SIZE { -// // Rollover a new heap. -// if string_heap.len() + slice.len() >= (i32::MAX as usize) { -// buffers.push(string_heap); -// string_heap = Vec::with_capacity(1024); -// } -// -// views.push(BinaryView::new_view( -// slice.len() as u32, -// [slice[0], slice[1], slice[2], slice[3]], -// buffers.len() as u32, -// string_heap.len() as u32, -// )); -// -// string_heap.extend_from_slice(slice); -// } else { -// // Append an inlined view. -// views.push(BinaryView::new_inlined(slice)); -// } -// -// vac.insert_with_hasher(value_hash, next_code, (), |code| { -// // Get access to the value...again. -// hasher.hash_one( -// -// ) -// }); -// next_code -// } -// }; -// codes.push(code) -// } -// } -// } -// -// let values_validity = if dtype.is_nullable() { -// let mut validity = BooleanBufferBuilder::new(views.len()); -// validity.append(false); // First code is false -// validity.append_n(true, offsets.len() - 2); -// -// validity.into() -// } else { -// Validity::NonNullable -// }; -// -// ( -// PrimitiveArray::from(codes), -// VarBinArray::try_new( -// PrimitiveArray::from(offsets).into_array(), -// PrimitiveArray::from(bytes).into_array(), -// dtype, -// values_validity, -// ) -// .vortex_expect("Failed to create VarBinArray dictionary during encoding"), -// ) -// } - fn dict_encode_typed_varbin(dtype: DType, values: I) -> (PrimitiveArray, VarBinArray) where I: Iterator>,