Skip to content

Commit 9a8872e

Browse files
committed
wip
giga wip (doesnt compile) wip
1 parent 0960a04 commit 9a8872e

93 files changed

Lines changed: 15000 additions & 1326 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4311,6 +4311,7 @@ dependencies = [
43114311
"rand",
43124312
"re_arrow2",
43134313
"re_build_info",
4314+
"re_error",
43144315
"re_format",
43154316
"re_format_arrow",
43164317
"re_log",
@@ -4526,6 +4527,7 @@ dependencies = [
45264527
"re_log_encoding",
45274528
"re_log_types",
45284529
"re_query",
4530+
"re_query2",
45294531
"re_smart_channel",
45304532
"re_tracing",
45314533
"re_types",
@@ -4714,6 +4716,39 @@ dependencies = [
47144716
"thiserror",
47154717
]
47164718

4719+
[[package]]
4720+
name = "re_query2"
4721+
version = "0.18.0-alpha.1+dev"
4722+
dependencies = [
4723+
"ahash",
4724+
"anyhow",
4725+
"backtrace",
4726+
"criterion",
4727+
"indent",
4728+
"indexmap 2.1.0",
4729+
"itertools 0.13.0",
4730+
"mimalloc",
4731+
"nohash-hasher",
4732+
"parking_lot",
4733+
"paste",
4734+
"rand",
4735+
"re_arrow2",
4736+
"re_chunk",
4737+
"re_chunk_store",
4738+
"re_error",
4739+
"re_format",
4740+
"re_log",
4741+
"re_log_types",
4742+
"re_tracing",
4743+
"re_tuid",
4744+
"re_types",
4745+
"re_types_core",
4746+
"seq-macro",
4747+
"similar-asserts",
4748+
"static_assertions",
4749+
"thiserror",
4750+
]
4751+
47174752
[[package]]
47184753
name = "re_renderer"
47194754
version = "0.18.0-alpha.1+dev"
@@ -4891,6 +4926,7 @@ dependencies = [
48914926
"re_log",
48924927
"re_log_types",
48934928
"re_query",
4929+
"re_query2",
48944930
"re_tracing",
48954931
"re_types_core",
48964932
"re_ui",
@@ -5049,7 +5085,7 @@ dependencies = [
50495085
"re_format",
50505086
"re_log",
50515087
"re_log_types",
5052-
"re_query",
5088+
"re_query2",
50535089
"re_renderer",
50545090
"re_space_view",
50555091
"re_tracing",
@@ -5278,6 +5314,7 @@ dependencies = [
52785314
"re_log_types",
52795315
"re_memory",
52805316
"re_query",
5317+
"re_query2",
52815318
"re_renderer",
52825319
"re_sdk_comms",
52835320
"re_selection_panel",
@@ -5349,6 +5386,7 @@ dependencies = [
53495386
"re_log_types",
53505387
"re_math",
53515388
"re_query",
5389+
"re_query2",
53525390
"re_renderer",
53535391
"re_smart_channel",
53545392
"re_string_interner",

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ re_format_arrow = { path = "crates/store/re_format_arrow", version = "=0.18.0-al
4949
re_log_encoding = { path = "crates/store/re_log_encoding", version = "=0.18.0-alpha.1", default-features = false }
5050
re_log_types = { path = "crates/store/re_log_types", version = "=0.18.0-alpha.1", default-features = false }
5151
re_query = { path = "crates/store/re_query", version = "=0.18.0-alpha.1", default-features = false }
52+
re_query2 = { path = "crates/store/re_query2", version = "=0.18.0-alpha.1", default-features = false }
5253
re_sdk_comms = { path = "crates/store/re_sdk_comms", version = "=0.18.0-alpha.1", default-features = false }
5354
re_types = { path = "crates/store/re_types", version = "=0.18.0-alpha.1", default-features = false }
5455
re_types_blueprint = { path = "crates/store/re_types_blueprint", version = "=0.18.0-alpha.1", default-features = false }

crates/store/re_chunk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ serde = [
3737

3838
# Rerun
3939
re_build_info.workspace = true
40+
re_error.workspace = true
4041
re_format.workspace = true
4142
re_format_arrow.workspace = true
4243
re_log.workspace = true

crates/store/re_chunk/src/chunk.rs

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ use std::{
33
sync::atomic::{AtomicU64, Ordering},
44
};
55

6-
use arrow2::array::{
7-
Array as ArrowArray, ListArray as ArrowListArray, PrimitiveArray as ArrowPrimitiveArray,
8-
StructArray as ArrowStructArray,
6+
use arrow2::{
7+
array::{
8+
Array as ArrowArray, ListArray as ArrowListArray, PrimitiveArray as ArrowPrimitiveArray,
9+
StructArray as ArrowStructArray,
10+
},
11+
Either,
912
};
1013

1114
use itertools::{izip, Itertools};
1215
use re_log_types::{EntityPath, ResolvedTimeRange, Time, TimeInt, TimePoint, Timeline};
13-
use re_types_core::{ComponentName, Loggable, LoggableBatch, SerializationError, SizeBytes};
16+
use re_types_core::{
17+
ComponentName, DeserializationError, Loggable, LoggableBatch, SerializationError, SizeBytes,
18+
};
1419

1520
use crate::{ChunkId, RowId};
1621

@@ -26,8 +31,18 @@ pub enum ChunkError {
2631
#[error(transparent)]
2732
Arrow(#[from] arrow2::error::Error),
2833

34+
#[error("{kind} index out of bounds: {index} (len={len})")]
35+
IndexOutOfBounds {
36+
kind: String,
37+
len: usize,
38+
index: usize,
39+
},
40+
2941
#[error(transparent)]
3042
Serialization(#[from] SerializationError),
43+
44+
#[error(transparent)]
45+
Deserialization(#[from] DeserializationError),
3146
}
3247

3348
pub type ChunkResult<T> = Result<T, ChunkError>;
@@ -822,6 +837,32 @@ impl Chunk {
822837
.map(|(&time, &counter)| RowId::from_u128((time as u128) << 64 | (counter as u128)))
823838
}
824839

840+
/// Returns an iterator over the [`RowId`]s of a [`Chunk`], for a given component.
841+
///
842+
/// This is different than [`Self::row_ids`]: it will only yield `RowId`s for rows at which
843+
/// there is data for the specified `component_name`.
844+
#[inline]
845+
pub fn component_row_ids(
846+
&self,
847+
component_name: &ComponentName,
848+
) -> impl Iterator<Item = RowId> + '_ {
849+
let Some(list_array) = self.components.get(component_name) else {
850+
return Either::Left(std::iter::empty());
851+
};
852+
853+
let row_ids = self.row_ids();
854+
855+
if let Some(validity) = list_array.validity() {
856+
Either::Right(Either::Left(
857+
row_ids
858+
.enumerate()
859+
.filter_map(|(i, o)| validity.get_bit(i).then_some(o)),
860+
))
861+
} else {
862+
Either::Right(Either::Right(row_ids))
863+
}
864+
}
865+
825866
/// Returns the [`RowId`]-range covered by this [`Chunk`].
826867
///
827868
/// `None` if the chunk `is_empty`.

0 commit comments

Comments
 (0)