Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 11, 2025
1 parent 995b74c commit 910269c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion crates/store/re_chunk/src/arrow_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ where
);

if indices.len() == array.len() {
let indices = indices.values().as_ref();
let indices = indices.values();

let starts_at_zero = || indices[0] == O::Native::ZERO;
let is_consecutive = || {
Expand Down
19 changes: 7 additions & 12 deletions crates/store/re_chunk/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ use ahash::HashMap;
use arrow::{
array::{
Array as ArrowArray, ArrayRef as ArrowArrayRef, ListArray as ArrowListArray,
StructArray as ArrowStructArray,
StructArray as ArrowStructArray, UInt64Array as ArrowUInt64Array,
},
buffer::ScalarBuffer as ArrowScalarBuffer,
};
use arrow2::{
array::{
Array as Arrow2Array, ListArray as Arrow2ListArray, PrimitiveArray as Arrow2PrimitiveArray,
},
array::{Array as Arrow2Array, ListArray as Arrow2ListArray},
Either,
};
use itertools::{izip, Itertools};
Expand Down Expand Up @@ -1206,21 +1204,18 @@ impl Chunk {

/// Returns the [`RowId`]s in their raw-est form: a tuple of (times, counters) arrays.
#[inline]
pub fn row_ids_raw(&self) -> (&Arrow2PrimitiveArray<u64>, &Arrow2PrimitiveArray<u64>) {
pub fn row_ids_raw(&self) -> (&ArrowUInt64Array, &ArrowUInt64Array) {
let [times, counters] = self.row_ids.columns() else {
panic!("RowIds are corrupt -- this should be impossible (sanity checked)");
};

#[allow(clippy::unwrap_used)]
let times = times
.as_any()
.downcast_ref::<Arrow2PrimitiveArray<u64>>()
.unwrap(); // sanity checked
let times = times.as_any().downcast_ref::<ArrowUInt64Array>().unwrap(); // sanity checked

#[allow(clippy::unwrap_used)]
let counters = counters
.as_any()
.downcast_ref::<Arrow2PrimitiveArray<u64>>()
.downcast_ref::<ArrowUInt64Array>()
.unwrap(); // sanity checked

(times, counters)
Expand All @@ -1232,7 +1227,7 @@ impl Chunk {
#[inline]
pub fn row_ids(&self) -> impl Iterator<Item = RowId> + '_ {
let (times, counters) = self.row_ids_raw();
izip!(times.values().as_ref(), counters.values().as_slice())
izip!(times.values(), counters.values())
.map(|(&time, &counter)| RowId::from_u128((time as u128) << 64 | (counter as u128)))
}

Expand Down Expand Up @@ -1274,7 +1269,7 @@ impl Chunk {
}

let (times, counters) = self.row_ids_raw();
let (times, counters) = (times.values().as_ref(), counters.values().as_slice());
let (times, counters) = (times.values(), counters.values());

#[allow(clippy::unwrap_used)] // checked above
let (index_min, index_max) = if self.is_sorted() {
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_chunk/src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,8 @@ impl Iterator for ChunkIndicesIter {

let row_id = {
let (times, incs) = self.chunk.row_ids_raw();
let times = times.values().as_slice();
let incs = incs.values().as_slice();
let times = times.values();
let incs = incs.values();

let time = *times.get(i)?;
let inc = *incs.get(i)?;
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_chunk/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ impl Chunk {
let row_id_inc = (row_id_128 & (!0 >> 64)) as u64;

let (times, incs) = self.row_ids_raw();
let times = times.values().as_slice();
let incs = incs.values().as_slice();
let times = times.values();
let incs = incs.values();

let mut index = times.partition_point(|&time| time < row_id_time_ns);
while index < incs.len() && incs[index] < row_id_inc {
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_dataframe/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,8 @@ impl<E: StorageEngineLike> QueryHandle<E> {
let cur_index_row_id_at = |at: usize| {
let (times, incs) = cur_index_row_ids;

let times = times.values().as_slice();
let incs = incs.values().as_slice();
let times = times.values();
let incs = incs.values();

let time = *times.get(at)?;
let inc = *incs.get(at)?;
Expand Down

0 comments on commit 910269c

Please sign in to comment.