Skip to content

Commit

Permalink
delete unusedcode for now
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Oct 18, 2024
1 parent 1b143da commit 548f63c
Showing 1 changed file with 0 additions and 97 deletions.
97 changes: 0 additions & 97 deletions encodings/dict/src/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,103 +117,6 @@ fn lookup_bytes<'a, T: NativePType + AsPrimitive<usize>>(
&bytes[begin..end]
}

// Impl our own for different things here.

// fn dict_encode_typed_view<I, U>(dtype: DType, values: I) -> (PrimitiveArray, VarBinViewArray)
// where
// I: Iterator<Item = Option<U>>,
// U: AsRef<[u8]>,
// {
// let (lower, _) = values.size_hint();
// let hasher = DefaultHashBuilder::default();
// let mut lookup_dict: HashMap<u64, (), ()> = HashMap::with_hasher(());
//
// // The codes, which will become the primitive array.
// let mut codes: Vec<u64> = Vec::with_capacity(lower);
//
// let mut views: Vec<BinaryView> = Vec::new();
//
// // Generate a new output buffer once we've overflowed the i32 range.
// let mut buffers: Vec<Vec<u8>> = Vec::with_capacity(1);
// let mut string_heap: Vec<u8> = 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<I, U>(dtype: DType, values: I) -> (PrimitiveArray, VarBinArray)
where
I: Iterator<Item = Option<U>>,
Expand Down

0 comments on commit 548f63c

Please sign in to comment.