Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch ArrowDict to signed and fix static datatype #7383

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/store/re_chunk/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn arrays_to_list_array(
pub fn arrays_to_dictionary<Idx: Copy + Eq>(
array_datatype: ArrowDatatype,
arrays: &[Option<(Idx, &dyn ArrowArray)>],
) -> Option<ArrowDictionaryArray<u32>> {
) -> Option<ArrowDictionaryArray<i32>> {
// Dedupe the input arrays based on the given primary key.
let arrays_dense_deduped = arrays
.iter()
Expand All @@ -96,7 +96,7 @@ pub fn arrays_to_dictionary<Idx: Copy + Eq>(

// Compute the keys for the final dictionary, using that same primary key.
let keys = {
let mut cur_key = 0u32;
let mut cur_key = 0i32;
arrays
.iter()
.dedup_by_with_count(|lhs, rhs| {
Expand Down Expand Up @@ -140,7 +140,7 @@ pub fn arrays_to_dictionary<Idx: Copy + Eq>(
};

let datatype = ArrowDatatype::Dictionary(
arrow2::datatypes::IntegerType::UInt32,
arrow2::datatypes::IntegerType::Int32,
std::sync::Arc::new(data.data_type().clone()),
true, // is_sorted
);
Expand All @@ -149,7 +149,7 @@ pub fn arrays_to_dictionary<Idx: Copy + Eq>(
// unique values.
ArrowDictionaryArray::try_new(
datatype,
ArrowPrimitiveArray::<u32>::from(keys),
ArrowPrimitiveArray::<i32>::from(keys),
data.to_boxed(),
)
.ok()
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_chunk_store/src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ impl ChunkStore {
archetype_name: None,
archetype_field_name: None,
component_name: *component_name,
datatype: datatype.clone(),
datatype: ArrowListArray::<i32>::default_datatype(datatype.clone()),
is_static: true,
})
})
Expand Down
8 changes: 4 additions & 4 deletions crates/store/re_dataframe/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl RangeQueryHandle<'_> {
.map(|col| match col {
ColumnDescriptor::Component(mut descr) => {
descr.datatype = ArrowDatatype::Dictionary(
arrow2::datatypes::IntegerType::UInt32,
arrow2::datatypes::IntegerType::Int32,
descr.datatype.into(),
true,
);
Expand Down Expand Up @@ -311,7 +311,7 @@ impl RangeQueryHandle<'_> {
// see if this ever becomes an issue before going down this road.
//
// TODO(cmc): Opportunities for parallelization, if it proves to be a net positive in practice.
let dict_arrays: HashMap<&ComponentColumnDescriptor, ArrowDictionaryArray<u32>> = {
let dict_arrays: HashMap<&ComponentColumnDescriptor, ArrowDictionaryArray<i32>> = {
re_tracing::profile_scope!("queries");

columns
Expand Down Expand Up @@ -612,7 +612,7 @@ mod tests {
})
.unwrap()
.as_any()
.downcast_ref::<ArrowDictionaryArray<u32>>()
.downcast_ref::<ArrowDictionaryArray<i32>>()
.unwrap()
.values()
.clone()
Expand All @@ -639,7 +639,7 @@ mod tests {
})
.unwrap()
.as_any()
.downcast_ref::<ArrowDictionaryArray<u32>>()
.downcast_ref::<ArrowDictionaryArray<i32>>()
.unwrap()
.values()
.clone()
Expand Down
Loading