From 23957176774a9d48f26840626d68f2cf01735364 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Thu, 25 Apr 2024 11:05:47 +0200 Subject: [PATCH] wip --- crates/re_data_store/benches/arrow2.rs | 19 ++- crates/re_data_store/benches/data_store.rs | 16 +- crates/re_data_store/benches/gc.rs | 14 +- crates/re_data_store/src/lib.rs | 3 +- crates/re_data_store/src/store.rs | 93 +--------- crates/re_data_store/src/store_arrow.rs | 61 +------ crates/re_data_store/src/store_dump.rs | 29 +--- crates/re_data_store/src/store_event.rs | 76 ++------- crates/re_data_store/src/store_format.rs | 7 - crates/re_data_store/src/store_gc.rs | 88 ++-------- crates/re_data_store/src/store_helpers.rs | 2 - crates/re_data_store/src/store_read.rs | 42 +---- crates/re_data_store/src/store_sanity.rs | 33 +--- crates/re_data_store/src/store_stats.rs | 28 +-- crates/re_data_store/src/store_subscriber.rs | 9 +- crates/re_data_store/src/store_write.rs | 159 ++---------------- crates/re_data_store/src/test_util.rs | 9 +- crates/re_data_store/tests/correctness.rs | 104 +++--------- crates/re_data_store/tests/data_store.rs | 122 ++++++-------- crates/re_data_store/tests/dump.rs | 36 ++-- crates/re_data_store/tests/internals.rs | 17 +- crates/re_data_store/tests/memory_test.rs | 6 +- crates/re_data_ui/src/component.rs | 11 +- .../re_data_ui/src/component_ui_registry.rs | 9 +- crates/re_data_ui/src/editors.rs | 36 ++-- crates/re_data_ui/src/entity_path.rs | 2 +- crates/re_data_ui/src/instance_path.rs | 6 +- crates/re_data_ui/src/item_ui.rs | 30 ++-- crates/re_data_ui/src/lib.rs | 2 +- crates/re_entity_db/examples/memory_usage.rs | 2 - crates/re_entity_db/src/entity_db.rs | 11 +- crates/re_entity_db/src/instance_path.rs | 73 ++++---- .../src/versioned_instance_path.rs | 10 +- crates/re_entity_db/tests/clear.rs | 21 +-- crates/re_entity_db/tests/time_histograms.rs | 50 +++--- .../benches/msg_encode_benchmark.rs | 3 - crates/re_log_types/src/data_cell.rs | 39 ----- crates/re_log_types/src/data_row.rs | 49 +----- crates/re_log_types/src/data_table.rs | 105 +++--------- crates/re_log_types/src/example_components.rs | 63 ++++++- crates/re_log_types/src/lib.rs | 21 ++- crates/re_log_types/src/num_instances.rs | 92 ---------- crates/re_log_types/src/path/data_path.rs | 16 +- crates/re_log_types/src/path/parse_path.rs | 60 +++---- crates/re_query/benches/latest_at.rs | 5 +- crates/re_query/examples/latest_at.rs | 7 +- .../re_query/examples/latest_at_archetype.rs | 9 +- crates/re_query/examples/range.rs | 11 +- crates/re_query/src/latest_at/results.rs | 9 +- crates/re_query/src/lib.rs | 2 - crates/re_query/tests/latest_at.rs | 60 ++----- crates/re_query/tests/range.rs | 61 ++----- crates/re_sdk/src/lib.rs | 2 +- crates/re_sdk/src/recording_stream.rs | 52 +----- crates/re_space_view/src/space_view.rs | 2 - .../src/space_view_class.rs | 24 +-- .../src/instance_hash_conversions.rs | 7 +- crates/re_space_view_spatial/src/picking.rs | 4 +- crates/re_space_view_spatial/src/ui.rs | 15 +- .../src/visualizers/arrows2d.rs | 11 +- .../src/visualizers/arrows3d.rs | 11 +- .../src/visualizers/assets3d.rs | 8 +- .../src/visualizers/boxes2d.rs | 11 +- .../src/visualizers/boxes3d.rs | 16 +- .../src/visualizers/cameras.rs | 9 +- .../src/visualizers/lines2d.rs | 11 +- .../src/visualizers/lines3d.rs | 11 +- .../src/visualizers/meshes.rs | 9 +- .../src/visualizers/mod.rs | 6 +- .../src/visualizers/points2d.rs | 10 +- .../src/visualizers/points3d.rs | 10 +- .../src/visualizers/transform3d_arrows.rs | 6 +- .../re_time_panel/src/data_density_graph.rs | 2 +- crates/re_time_panel/src/lib.rs | 2 +- .../src/archetypes/annotation_context.rs | 14 +- crates/re_types/src/archetypes/arrows2d.rs | 13 +- crates/re_types/src/archetypes/arrows3d.rs | 13 +- crates/re_types/src/archetypes/asset3d.rs | 19 +-- crates/re_types/src/archetypes/bar_chart.rs | 19 +-- crates/re_types/src/archetypes/boxes2d.rs | 13 +- crates/re_types/src/archetypes/boxes3d.rs | 13 +- crates/re_types/src/archetypes/depth_image.rs | 13 +- .../src/archetypes/disconnected_space.rs | 14 +- crates/re_types/src/archetypes/image.rs | 19 +-- .../re_types/src/archetypes/line_strips2d.rs | 13 +- .../re_types/src/archetypes/line_strips3d.rs | 13 +- crates/re_types/src/archetypes/mesh3d.rs | 13 +- crates/re_types/src/archetypes/pinhole.rs | 19 +-- crates/re_types/src/archetypes/points2d.rs | 13 +- crates/re_types/src/archetypes/points3d.rs | 13 +- crates/re_types/src/archetypes/scalar.rs | 14 +- .../src/archetypes/segmentation_image.rs | 19 +-- crates/re_types/src/archetypes/series_line.rs | 13 +- .../re_types/src/archetypes/series_point.rs | 13 +- crates/re_types/src/archetypes/tensor.rs | 14 +- .../re_types/src/archetypes/text_document.rs | 19 +-- crates/re_types/src/archetypes/text_log.rs | 19 +-- crates/re_types/src/archetypes/transform3d.rs | 14 +- .../src/archetypes/view_coordinates.rs | 14 +- .../src/blueprint/archetypes/background3d.rs | 19 +-- .../src/blueprint/archetypes/plot_legend.rs | 13 +- .../src/blueprint/archetypes/scalar_axis.rs | 13 +- .../archetypes/space_view_blueprint.rs | 13 +- .../archetypes/space_view_contents.rs | 19 +-- crates/re_types/src/datagen.rs | 25 --- crates/re_types/src/lib.rs | 16 +- .../src/testing/archetypes/affix_fuzzer1.rs | 14 +- .../src/testing/archetypes/affix_fuzzer2.rs | 14 +- .../src/testing/archetypes/affix_fuzzer3.rs | 13 +- .../src/testing/archetypes/affix_fuzzer4.rs | 13 +- .../archetypes/container_blueprint.rs | 13 +- .../blueprint/archetypes/panel_blueprint.rs | 19 +-- .../archetypes/viewport_blueprint.rs | 13 +- .../re_types_builder/src/codegen/cpp/mod.rs | 27 --- .../re_types_builder/src/codegen/rust/api.rs | 32 +--- crates/re_types_core/src/archetype.rs | 2 +- crates/re_types_core/src/archetypes/clear.rs | 14 +- crates/re_types_core/src/lib.rs | 13 -- crates/re_ui/src/syntax_highlighting.rs | 14 +- crates/re_viewer/src/app_blueprint.rs | 9 +- crates/re_viewer/src/ui/memory_panel.rs | 6 - crates/re_viewer/src/ui/override_ui.rs | 26 +-- crates/re_viewer/src/ui/selection_panel.rs | 8 +- .../src/blueprint_helpers.rs | 36 +--- .../src/component_ui_registry.rs | 24 +-- crates/re_viewer_context/src/item.rs | 34 ++-- .../re_viewer_context/src/selection_state.rs | 12 +- .../src/space_view/highlights.rs | 29 ++-- .../actions/collapse_expand_all.rs | 2 +- .../src/context_menu/actions/remove.rs | 2 +- .../src/context_menu/actions/show_hide.rs | 2 +- .../src/space_view_entity_picker.rs | 2 +- .../re_viewport/src/viewport_blueprint_ui.rs | 4 +- crates/rerun/src/sdk.rs | 6 +- crates/rerun_c/src/lib.rs | 7 +- crates/rerun_c/src/rerun.h | 4 - docs/content/concepts/batches.md | 19 +-- docs/content/getting-started/data-in/cpp.md | 2 +- .../content/getting-started/data-in/python.md | 2 +- docs/content/getting-started/data-in/rust.md | 2 +- docs/snippets/all/custom_data.py | 2 +- .../src/color_coordinates_space_view.rs | 14 +- .../color_coordinates_visualizer_system.rs | 20 +-- rerun_cpp/src/rerun.hpp | 1 - .../rerun/archetypes/annotation_context.hpp | 5 - rerun_cpp/src/rerun/archetypes/arrows2d.hpp | 5 - rerun_cpp/src/rerun/archetypes/arrows3d.hpp | 5 - rerun_cpp/src/rerun/archetypes/asset3d.hpp | 5 - rerun_cpp/src/rerun/archetypes/bar_chart.hpp | 5 - rerun_cpp/src/rerun/archetypes/boxes2d.hpp | 5 - rerun_cpp/src/rerun/archetypes/boxes3d.hpp | 5 - rerun_cpp/src/rerun/archetypes/clear.hpp | 5 - .../src/rerun/archetypes/depth_image.hpp | 5 - .../rerun/archetypes/disconnected_space.hpp | 5 - rerun_cpp/src/rerun/archetypes/image.hpp | 5 - .../src/rerun/archetypes/line_strips2d.hpp | 5 - .../src/rerun/archetypes/line_strips3d.hpp | 5 - rerun_cpp/src/rerun/archetypes/mesh3d.hpp | 5 - rerun_cpp/src/rerun/archetypes/pinhole.hpp | 5 - rerun_cpp/src/rerun/archetypes/points2d.hpp | 5 - rerun_cpp/src/rerun/archetypes/points3d.hpp | 5 - rerun_cpp/src/rerun/archetypes/scalar.hpp | 5 - .../rerun/archetypes/segmentation_image.hpp | 5 - .../src/rerun/archetypes/series_line.hpp | 5 - .../src/rerun/archetypes/series_point.hpp | 5 - rerun_cpp/src/rerun/archetypes/tensor.hpp | 5 - .../src/rerun/archetypes/text_document.hpp | 5 - rerun_cpp/src/rerun/archetypes/text_log.hpp | 5 - .../src/rerun/archetypes/transform3d.hpp | 5 - .../src/rerun/archetypes/view_coordinates.hpp | 5 - .../blueprint/archetypes/background3d.hpp | 5 - .../archetypes/container_blueprint.hpp | 5 - .../blueprint/archetypes/panel_blueprint.hpp | 5 - .../blueprint/archetypes/plot_legend.hpp | 5 - .../blueprint/archetypes/scalar_axis.hpp | 5 - .../archetypes/space_view_blueprint.hpp | 5 - .../archetypes/space_view_contents.hpp | 5 - .../archetypes/viewport_blueprint.hpp | 5 - rerun_cpp/src/rerun/c/rerun.h | 6 +- rerun_cpp/src/rerun/recording_stream.cpp | 38 +---- rerun_cpp/src/rerun/recording_stream.hpp | 6 +- .../generated/archetypes/affix_fuzzer1.hpp | 5 - .../generated/archetypes/affix_fuzzer2.hpp | 5 - .../generated/archetypes/affix_fuzzer3.hpp | 5 - .../generated/archetypes/affix_fuzzer4.hpp | 5 - rerun_py/rerun_sdk/rerun/_baseclasses.py | 7 +- rerun_py/rerun_sdk/rerun/_log.py | 24 +-- rerun_py/rerun_sdk/rerun/any_value.py | 3 - rerun_py/src/arrow.rs | 11 +- tests/python/test_api/test_api.py | 1 - 190 files changed, 844 insertions(+), 2496 deletions(-) delete mode 100644 crates/re_log_types/src/num_instances.rs diff --git a/crates/re_data_store/benches/arrow2.rs b/crates/re_data_store/benches/arrow2.rs index dee0628802d02..236e3db60c3fc 100644 --- a/crates/re_data_store/benches/arrow2.rs +++ b/crates/re_data_store/benches/arrow2.rs @@ -9,10 +9,11 @@ use arrow2::array::{Array, FixedSizeListArray, PrimitiveArray, StructArray}; use criterion::Criterion; use itertools::Itertools; +use re_log_types::example_components::MyIndex; use re_log_types::DataCell; -use re_types::datagen::{build_some_instances, build_some_positions2d}; +use re_types::datagen::build_some_positions2d; use re_types::{ - components::{InstanceKey, Position2D}, + components::Position2D, testing::{build_some_large_structs, LargeStruct}, }; use re_types_core::{Component, SizeBytes}; @@ -40,7 +41,7 @@ const NUM_INSTANCES: usize = 1; #[derive(Debug, Clone, Copy)] enum ArrayKind { - /// E.g. an array of `InstanceKey`. + /// E.g. an array of `MyIndex`. Primitive, /// E.g. an array of `Position2D`. @@ -79,7 +80,7 @@ fn erased_clone(c: &mut Criterion) { match kind { ArrayKind::Primitive => { - let data = build_some_instances(NUM_INSTANCES); + let data = MyIndex::from_iter(0..NUM_INSTANCES as _); bench_arrow(&mut group, &data); bench_native(&mut group, &data); } @@ -198,7 +199,9 @@ fn estimated_size_bytes(c: &mut Criterion) { fn generate_cells(kind: ArrayKind) -> Vec { match kind { ArrayKind::Primitive => (0..NUM_ROWS) - .map(|_| DataCell::from_native(build_some_instances(NUM_INSTANCES).as_slice())) + .map(|_| { + DataCell::from_native(MyIndex::from_iter(0..NUM_INSTANCES as _).as_slice()) + }) .collect(), ArrayKind::Struct => (0..NUM_ROWS) .map(|_| { @@ -312,9 +315,9 @@ fn estimated_size_bytes(c: &mut Criterion) { .collect() } - fn generate_keys() -> Vec> { + fn generate_indices() -> Vec> { (0..NUM_ROWS) - .map(|_| build_some_instances(NUM_INSTANCES)) + .map(|_| MyIndex::from_iter(0..NUM_INSTANCES as _)) .collect() } @@ -325,7 +328,7 @@ fn estimated_size_bytes(c: &mut Criterion) { } match kind { - ArrayKind::Primitive => bench_std(&mut group, generate_keys()), + ArrayKind::Primitive => bench_std(&mut group, generate_indices()), ArrayKind::Struct => bench_std(&mut group, generate_positions()), ArrayKind::StructLarge => bench_std(&mut group, generate_rects()), } diff --git a/crates/re_data_store/benches/data_store.rs b/crates/re_data_store/benches/data_store.rs index 8b95671180a3a..4d6b81cb33331 100644 --- a/crates/re_data_store/benches/data_store.rs +++ b/crates/re_data_store/benches/data_store.rs @@ -9,14 +9,10 @@ use re_data_store::{ RangeQuery, TimeInt, TimeRange, }; use re_log_types::{ - build_frame_nr, DataCell, DataRow, DataTable, EntityPath, RowId, TableId, TimePoint, TimeType, - Timeline, -}; -use re_types::datagen::build_some_instances; -use re_types::{ - components::InstanceKey, - testing::{build_some_large_structs, LargeStruct}, + build_frame_nr, example_components::MyIndex, DataCell, DataRow, DataTable, EntityPath, RowId, + TableId, TimePoint, TimeType, Timeline, }; +use re_types::testing::{build_some_large_structs, LargeStruct}; use re_types_core::{ComponentName, Loggable as _}; criterion_group!( @@ -123,7 +119,6 @@ fn insert_same_time_point(c: &mut Criterion) { b.iter(|| { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig::default(), ); @@ -398,9 +393,8 @@ fn build_rows_ex( RowId::new(), "large_structs", time_point(frame_idx), - num_instances as _, ( - build_some_instances(num_instances), + MyIndex::from_iter(0..num_instances as _), build_some_large_structs(num_instances), ), ) @@ -432,10 +426,8 @@ fn build_rows_ex( } fn insert_rows(config: DataStoreConfig, rows: &[DataRow]) -> DataStore { - let cluster_key = InstanceKey::name(); let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - cluster_key, config, ); for row in rows { diff --git a/crates/re_data_store/benches/gc.rs b/crates/re_data_store/benches/gc.rs index ea1aaab316edb..3e840aac1c676 100644 --- a/crates/re_data_store/benches/gc.rs +++ b/crates/re_data_store/benches/gc.rs @@ -10,8 +10,7 @@ use re_data_store::{ use re_log_types::{ build_frame_nr, build_log_time, DataRow, DataTable, EntityPath, RowId, TableId, Time, TimePoint, }; -use re_types::components::InstanceKey; -use re_types_core::{AsComponents, ComponentBatch, ComponentName, Loggable as _}; +use re_types_core::{AsComponents, ComponentBatch}; criterion_group!(benches, plotting_dashboard); criterion_main!(benches); @@ -85,13 +84,7 @@ fn plotting_dashboard(c: &mut Criterion) { // Default config group.bench_function("default", |b| { - let store = build_store( - Default::default(), - InstanceKey::name(), - false, - &mut timegen, - &mut datagen, - ); + let store = build_store(Default::default(), false, &mut timegen, &mut datagen); b.iter_batched( || store.clone(), |mut store| { @@ -117,7 +110,6 @@ fn plotting_dashboard(c: &mut Criterion) { indexed_bucket_num_rows: num_rows_per_bucket, ..Default::default() }, - InstanceKey::name(), false, &mut timegen, &mut datagen, @@ -142,7 +134,6 @@ fn plotting_dashboard(c: &mut Criterion) { fn build_store( config: DataStoreConfig, - cluster_key: ComponentName, packed: bool, timegen: &mut FT, datagen: &mut FD, @@ -153,7 +144,6 @@ where { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - cluster_key, config, ); diff --git a/crates/re_data_store/src/lib.rs b/crates/re_data_store/src/lib.rs index 07227c54a0f1d..19da79f88717b 100644 --- a/crates/re_data_store/src/lib.rs +++ b/crates/re_data_store/src/lib.rs @@ -41,8 +41,7 @@ pub use self::store_subscriber::{StoreSubscriber, StoreSubscriberHandle}; pub use self::store_write::{WriteError, WriteResult}; pub(crate) use self::store::{ - ClusterCellCache, IndexedBucket, IndexedBucketInner, IndexedTable, MetadataRegistry, - StaticCell, StaticTable, + IndexedBucket, IndexedBucketInner, IndexedTable, MetadataRegistry, StaticCell, StaticTable, }; // Re-exports diff --git a/crates/re_data_store/src/store.rs b/crates/re_data_store/src/store.rs index fbf0515b8fcc2..528018ee9ba0c 100644 --- a/crates/re_data_store/src/store.rs +++ b/crates/re_data_store/src/store.rs @@ -5,8 +5,8 @@ use arrow2::datatypes::DataType; use nohash_hasher::IntMap; use parking_lot::RwLock; use re_log_types::{ - DataCell, DataCellColumn, EntityPath, EntityPathHash, ErasedTimeVec, NumInstances, - NumInstancesVec, RowId, RowIdVec, StoreId, TimeInt, TimePoint, TimeRange, Timeline, + DataCell, DataCellColumn, EntityPath, EntityPathHash, ErasedTimeVec, RowId, RowIdVec, StoreId, + TimeInt, TimePoint, TimeRange, Timeline, }; use re_types_core::{ComponentName, ComponentNameSet, SizeBytes}; @@ -123,27 +123,6 @@ impl std::ops::DerefMut for MetadataRegistry { } } -/// Used to cache auto-generated cluster cells (`[0]`, `[0, 1]`, `[0, 1, 2]`, …) so that they -/// can be properly deduplicated on insertion. -#[derive(Debug, Default, Clone)] -pub struct ClusterCellCache(pub IntMap); - -impl std::ops::Deref for ClusterCellCache { - type Target = IntMap; - - #[inline] - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl std::ops::DerefMut for ClusterCellCache { - #[inline] - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - // --- /// Incremented on each edit. @@ -164,20 +143,6 @@ pub struct StoreGeneration { pub struct DataStore { pub(crate) id: StoreId, - /// The cluster key specifies a column/component that is guaranteed to always be present for - /// every single row of data within the store. - /// - /// In addition to always being present, the payload of the cluster key..: - /// - is always increasingly sorted, - /// - is always dense (no validity bitmap), - /// - and never contains duplicate entries. - /// - /// This makes the cluster key a perfect candidate for joining query results together, and - /// doing so as efficiently as possible. - /// - /// See [`Self::insert_row`] for more information. - pub(crate) cluster_key: ComponentName, - /// The configuration of the data store (e.g. bucket sizes). pub(crate) config: DataStoreConfig, @@ -192,10 +157,6 @@ pub struct DataStore { /// Keeps track of arbitrary per-row metadata. pub(crate) metadata_registry: MetadataRegistry<(TimePoint, EntityPathHash)>, - /// Used to cache auto-generated cluster cells (`[0]`, `[0, 1]`, `[0, 1, 2]`, …) - /// so that they can be properly deduplicated on insertion. - pub(crate) cluster_cell_cache: ClusterCellCache, - /// All temporal [`IndexedTable`]s for all entities on all timelines. /// /// See also [`Self::static_tables`]. @@ -227,11 +188,9 @@ impl Clone for DataStore { fn clone(&self) -> Self { Self { id: self.id.clone(), - cluster_key: self.cluster_key, config: self.config.clone(), type_registry: self.type_registry.clone(), metadata_registry: self.metadata_registry.clone(), - cluster_cell_cache: self.cluster_cell_cache.clone(), tables: self.tables.clone(), static_tables: self.static_tables.clone(), insert_id: Default::default(), @@ -243,13 +202,10 @@ impl Clone for DataStore { } impl DataStore { - /// See [`Self::cluster_key`] for more information about the cluster key. - pub fn new(id: StoreId, cluster_key: ComponentName, config: DataStoreConfig) -> Self { + pub fn new(id: StoreId, config: DataStoreConfig) -> Self { Self { id, - cluster_key, config, - cluster_cell_cache: Default::default(), type_registry: Default::default(), metadata_registry: Default::default(), tables: Default::default(), @@ -283,11 +239,6 @@ impl DataStore { } } - /// See [`Self::cluster_key`] for more information about the cluster key. - pub fn cluster_key(&self) -> ComponentName { - self.cluster_key - } - /// See [`DataStoreConfig`] for more information about configuration. pub fn config(&self) -> &DataStoreConfig { &self.config @@ -355,10 +306,6 @@ pub struct IndexedTable { /// The entity this table is related to, for debugging purposes. pub entity_path: EntityPath, - /// Carrying the cluster key around to help with assertions and sanity checks all over the - /// place. - pub cluster_key: ComponentName, - /// The actual buckets, where the data is stored. /// /// The keys of this `BTreeMap` represent the lower bounds of the time-ranges covered by @@ -388,14 +335,13 @@ pub struct IndexedTable { } impl IndexedTable { - pub fn new(cluster_key: ComponentName, timeline: Timeline, entity_path: EntityPath) -> Self { - let bucket = IndexedBucket::new(cluster_key, timeline); + pub fn new(timeline: Timeline, entity_path: EntityPath) -> Self { + let bucket = IndexedBucket::new(timeline); let buckets_size_bytes = bucket.total_size_bytes(); Self { timeline, entity_path, buckets: [(TimeInt::MIN, bucket)].into(), - cluster_key, all_components: Default::default(), buckets_num_rows: 0, buckets_size_bytes, @@ -412,14 +358,13 @@ impl IndexedTable { let Self { timeline, entity_path: _, - cluster_key, buckets, all_components: _, // keep the history on purpose buckets_num_rows, buckets_size_bytes, } = self; - let bucket = IndexedBucket::new(*cluster_key, *timeline); + let bucket = IndexedBucket::new(*timeline); let size_bytes = bucket.total_size_bytes(); *buckets = [(TimeInt::MIN, bucket)].into(); @@ -441,10 +386,6 @@ pub struct IndexedBucket { /// The timeline the bucket's parent table operates in, for debugging purposes. pub timeline: Timeline, - /// Carrying the cluster key around to help with assertions and sanity checks all over the - /// place. - pub cluster_key: ComponentName, - // To simplify interior mutability. pub inner: RwLock, } @@ -453,18 +394,16 @@ impl Clone for IndexedBucket { fn clone(&self) -> Self { Self { timeline: self.timeline, - cluster_key: self.cluster_key, inner: RwLock::new(self.inner.read().clone()), } } } impl IndexedBucket { - pub(crate) fn new(cluster_key: ComponentName, timeline: Timeline) -> Self { + pub(crate) fn new(timeline: Timeline) -> Self { Self { timeline, inner: RwLock::new(IndexedBucketInner::default()), - cluster_key, } } } @@ -503,11 +442,6 @@ pub struct IndexedBucketInner { /// `RowId::ZERO` for empty buckets. pub max_row_id: RowId, - /// The entire column of `num_instances`. - /// - /// Keeps track of the expected number of instances in each row. - pub col_num_instances: NumInstancesVec, - /// All the rows for all the component columns. /// /// The cells are optional since not all rows will have data for every single component @@ -533,7 +467,6 @@ impl Default for IndexedBucketInner { col_insert_id: Default::default(), col_row_id: Default::default(), max_row_id: RowId::ZERO, - col_num_instances: Default::default(), columns: Default::default(), size_bytes: 0, // NOTE: computed below }; @@ -550,10 +483,6 @@ pub struct StaticTable { /// The entity this table is related to, for debugging purposes. pub entity_path: EntityPath, - /// Carrying the cluster key around to help with assertions and sanity checks all over the - /// place. - pub cluster_key: ComponentName, - /// Keeps track of one and only one [`StaticCell`] per component. /// /// Last-write-wins semantics apply, where ordering is defined by `RowId`. @@ -562,10 +491,9 @@ pub struct StaticTable { impl StaticTable { #[inline] - pub fn new(cluster_key: ComponentName, entity_path: EntityPath) -> Self { + pub fn new(entity_path: EntityPath) -> Self { Self { entity_path, - cluster_key, cells: Default::default(), } } @@ -577,10 +505,5 @@ pub struct StaticCell { pub insert_id: Option, pub row_id: RowId, - pub num_instances: NumInstances, pub cell: DataCell, - - // TODO(#5303): We keep track of cluster keys for each static cell for backwards - // compatibility with the legacy instance-key model. This will go away next. - pub cluster_key: DataCell, } diff --git a/crates/re_data_store/src/store_arrow.rs b/crates/re_data_store/src/store_arrow.rs index 60a792fada5c3..eb398f1155f77 100644 --- a/crates/re_data_store/src/store_arrow.rs +++ b/crates/re_data_store/src/store_arrow.rs @@ -2,7 +2,7 @@ use std::collections::{BTreeMap, VecDeque}; use arrow2::{array::Array, chunk::Chunk, datatypes::Schema}; use nohash_hasher::IntMap; -use re_log_types::{DataCellColumn, DataTable, DataTableResult, NumInstances, RowId, Timeline}; +use re_log_types::{DataCellColumn, DataTable, DataTableResult, RowId, Timeline}; use re_types_core::ComponentName; use crate::{ @@ -19,17 +19,11 @@ impl IndexedBucket { /// - `insert_id` /// - `row_id` /// - `time` - /// - `num_instances` - /// - `$cluster_key` /// - rest of component columns in ascending lexical order pub fn serialize(&self) -> DataTableResult<(Schema, Chunk>)> { re_tracing::profile_function!(); - let Self { - timeline, - cluster_key, - inner, - } = self; + let Self { timeline, inner } = self; let IndexedBucketInner { is_sorted: _, @@ -38,17 +32,14 @@ impl IndexedBucket { col_insert_id, col_row_id, max_row_id: _, - col_num_instances, columns, size_bytes: _, } = &*inner.read(); serialize( - cluster_key, Some((*timeline, col_time)), col_insert_id, col_row_id, - col_num_instances, columns, ) } @@ -61,15 +52,10 @@ impl StaticTable { /// - `insert_id` /// - `row_id` /// - `time` - /// - `num_instances` - /// - `$cluster_key` /// - rest of component columns in ascending lexical order pub fn serialize(&self) -> DataTableResult<(Schema, Chunk>)> { re_tracing::profile_function!(); - // NOTE: cannot fail, the cluster key _has_ to be there by definition - let cluster_keys = &self.cells[&self.cluster_key]; - let mut cells_per_row_id: BTreeMap> = Default::default(); for static_cell in self.cells.values() { cells_per_row_id @@ -77,9 +63,6 @@ impl StaticTable { .or_default() .push(static_cell.clone()); } - for cells in cells_per_row_id.values_mut() { - cells.push(cluster_keys.clone()); - } let col_insert_id = cells_per_row_id .values() @@ -88,11 +71,6 @@ impl StaticTable { let col_row_id = cells_per_row_id.keys().copied().collect(); - let col_num_instances = cells_per_row_id - .values() - .filter_map(|cells| cells.first().map(|cell| cell.num_instances)) - .collect(); - let component_names: Vec<_> = self .cells .values() @@ -113,25 +91,16 @@ impl StaticTable { } } - serialize( - &self.cluster_key, - None, - &col_insert_id, - &col_row_id, - &col_num_instances, - &columns, - ) + serialize(None, &col_insert_id, &col_row_id, &columns) } } // --- fn serialize( - cluster_key: &ComponentName, col_time: Option<(Timeline, &VecDeque)>, col_insert_id: &VecDeque, col_row_id: &VecDeque, - col_num_instances: &VecDeque, table: &IntMap, ) -> DataTableResult<(Schema, Chunk>)> { re_tracing::profile_function!(); @@ -146,14 +115,14 @@ fn serialize( { let (control_schema, control_columns) = - serialize_control_columns(col_time, col_insert_id, col_row_id, col_num_instances)?; + serialize_control_columns(col_time, col_insert_id, col_row_id)?; schema.fields.extend(control_schema.fields); schema.metadata.extend(control_schema.metadata); columns.extend(control_columns); } { - let (data_schema, data_columns) = serialize_data_columns(cluster_key, table)?; + let (data_schema, data_columns) = serialize_data_columns(table)?; schema.fields.extend(data_schema.fields); schema.metadata.extend(data_schema.metadata); columns.extend(data_columns); @@ -166,7 +135,6 @@ fn serialize_control_columns( col_time: Option<(Timeline, &VecDeque)>, col_insert_id: &VecDeque, col_row_id: &VecDeque, - col_num_instances: &VecDeque, ) -> DataTableResult<(Schema, Vec>)> { re_tracing::profile_function!(); @@ -177,7 +145,6 @@ fn serialize_control_columns( // - insert_id // - row_id // - time - // - num_instances // NOTE: Optional column, so make sure it's actually there: if !col_insert_id.is_empty() { @@ -204,16 +171,10 @@ fn serialize_control_columns( columns.push(time_column); } - let (num_instances_field, num_instances_column) = - DataTable::serialize_control_column(col_num_instances)?; - schema.fields.push(num_instances_field); - columns.push(num_instances_column); - Ok((schema, columns)) } fn serialize_data_columns( - cluster_key: &ComponentName, table: &IntMap, ) -> DataTableResult<(Schema, Vec>)> { re_tracing::profile_function!(); @@ -222,17 +183,7 @@ fn serialize_data_columns( let mut columns = Vec::new(); // NOTE: ordering is taken into account! - let mut table: BTreeMap<_, _> = table.iter().collect(); - - // Cluster column first and foremost! - // - // NOTE: cannot fail, the cluster key _has_ to be there by definition - let cluster_column = table.remove(&cluster_key).unwrap(); - { - let (field, column) = DataTable::serialize_data_column(cluster_key, cluster_column)?; - schema.fields.push(field); - columns.push(column); - } + let table: BTreeMap<_, _> = table.iter().collect(); for (component, column) in table { // NOTE: Don't serialize columns with only null values. diff --git a/crates/re_data_store/src/store_dump.rs b/crates/re_data_store/src/store_dump.rs index f44b31b351282..2e1e24fb9ffc3 100644 --- a/crates/re_data_store/src/store_dump.rs +++ b/crates/re_data_store/src/store_dump.rs @@ -63,7 +63,6 @@ impl DataStore { /// Serializes the entire datastore into an iterator of [`DataTable`]s, where each table /// corresponds 1-to-1 to an internal bucket. - // TODO(#1793): This shouldn't dump cluster keys that were autogenerated. pub fn to_data_tables( &self, time_filter: Option<(Timeline, TimeRange)>, @@ -95,14 +94,7 @@ impl DataStore { row_id, TimePoint::default(), static_table.entity_path.clone(), - static_cells - .iter() - .map(|cell| cell.num_instances.0) - .max() - .unwrap_or_default(), - static_cells - .into_iter() - .flat_map(|static_cell| [static_cell.cell, static_cell.cluster_key]), + static_cells.into_iter().map(|static_cell| static_cell.cell), ) .ok() }); @@ -120,11 +112,7 @@ impl DataStore { bucket.sort_indices_if_needed(); - let IndexedBucket { - timeline, - cluster_key: _, - inner, - } = bucket; + let IndexedBucket { timeline, inner } = bucket; let IndexedBucketInner { is_sorted: _, @@ -133,7 +121,6 @@ impl DataStore { col_insert_id: _, col_row_id, max_row_id: _, - col_num_instances, columns, size_bytes: _, } = &*inner.read(); @@ -146,7 +133,6 @@ impl DataStore { col_entity_path: std::iter::repeat_with(|| table.entity_path.clone()) .take(col_row_id.len()) .collect(), - col_num_instances: col_num_instances.clone(), columns: columns.clone().into_iter().collect(), // shallow } }) @@ -171,11 +157,7 @@ impl DataStore { bucket.sort_indices_if_needed(); - let IndexedBucket { - timeline, - cluster_key: _, - inner, - } = bucket; + let IndexedBucket { timeline, inner } = bucket; let IndexedBucketInner { is_sorted: _, @@ -184,7 +166,6 @@ impl DataStore { col_insert_id: _, col_row_id, max_row_id: _, - col_num_instances, columns, size_bytes: _, } = &*inner.read(); @@ -215,9 +196,6 @@ impl DataStore { .take(col_row_id.len()) .collect(); - let col_num_instances = - filter_column(col_time, col_num_instances.iter(), time_filter).collect(); - let mut columns2 = BTreeMap::default(); for (component, column) in columns { let column = filter_column(col_time, column.iter(), time_filter).collect(); @@ -229,7 +207,6 @@ impl DataStore { col_row_id, col_timelines, col_entity_path, - col_num_instances, columns: columns2, }) })) diff --git a/crates/re_data_store/src/store_event.rs b/crates/re_data_store/src/store_event.rs index b4e2b6de4b656..971c47a829bb1 100644 --- a/crates/re_data_store/src/store_event.rs +++ b/crates/re_data_store/src/store_event.rs @@ -211,10 +211,10 @@ mod tests { use std::collections::BTreeMap; use re_log_types::{ - example_components::{MyColor, MyPoint}, + example_components::{MyColor, MyIndex, MyPoint}, DataRow, RowId, TimePoint, Timeline, }; - use re_types_core::{components::InstanceKey, Loggable as _}; + use re_types_core::Loggable as _; use crate::{DataStore, GarbageCollectionOptions}; @@ -285,7 +285,6 @@ mod tests { fn store_events() -> anyhow::Result<()> { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -306,7 +305,7 @@ mod tests { row_id1, timepoint1.clone(), entity_path1.clone(), - [&InstanceKey::from_iter(0..10) as _], + [&MyIndex::from_iter(0..10) as _], )?; view.on_events(&[store.insert_row(&row1)?]); @@ -325,7 +324,7 @@ mod tests { (entity_path1.clone(), 1), // ], [ - (InstanceKey::name(), 1), // + (MyIndex::name(), 1), // ], [ (42.try_into().unwrap(), 1), // @@ -375,9 +374,9 @@ mod tests { (entity_path2.clone(), 1), // ], [ - (InstanceKey::name(), 1), // autogenerated, doesn't change - (MyPoint::name(), 1), // - (MyColor::name(), 1), // + (MyIndex::name(), 1), // autogenerated, doesn't change + (MyPoint::name(), 1), // + (MyColor::name(), 1), // ], [ (42.try_into().unwrap(), 2), // @@ -399,7 +398,7 @@ mod tests { timepoint3.clone(), entity_path2.clone(), [ - &InstanceKey::from_iter(0..num_instances as _) as _, + &MyIndex::from_iter(0..num_instances as _) as _, &colors as _, ], )? @@ -424,9 +423,9 @@ mod tests { (entity_path2.clone(), 2), // ], [ - (InstanceKey::name(), 2), // - (MyPoint::name(), 1), // - (MyColor::name(), 2), // + (MyIndex::name(), 2), // + (MyPoint::name(), 1), // + (MyColor::name(), 2), // ], [ (42.try_into().unwrap(), 2), // @@ -458,9 +457,9 @@ mod tests { (entity_path2.clone(), 1), // static -- no gc ], [ - (InstanceKey::name(), 1), // static -- no gc - (MyPoint::name(), 0), // - (MyColor::name(), 1), // static -- no gc + (MyIndex::name(), 1), // static -- no gc + (MyPoint::name(), 0), // + (MyColor::name(), 1), // static -- no gc ], [ (42.try_into().unwrap(), 0), // @@ -474,51 +473,4 @@ mod tests { Ok(()) } - - #[test] - fn autogenerated_cluster_keys() -> anyhow::Result<()> { - let mut store = DataStore::new( - re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), - Default::default(), - ); - - let timeline_frame = Timeline::new_sequence("frame"); - - let row1 = DataRow::from_component_batches( - RowId::new(), - TimePoint::from_iter([(timeline_frame, 42)]), - "entity_a".into(), - [&InstanceKey::from_iter(0..10) as _], - )?; - - // Not autogenerated, should fire. - { - let event = store.insert_row(&row1)?; - assert!(event.cells.contains_key(&store.cluster_key())); - - let (events, _) = store.gc(&GarbageCollectionOptions::gc_everything()); - assert_eq!(1, events.len()); - assert!(events[0].cells.contains_key(&store.cluster_key())); - } - - let row2 = DataRow::from_component_batches( - RowId::new(), - TimePoint::from_iter([(timeline_frame, 42)]), - "entity_b".into(), - [&[MyColor::from(0xAABBCCDD)] as _], - )?; - - // Autogenerated, should _not_ fire. - { - let event = store.insert_row(&row2)?; - assert!(!event.cells.contains_key(&store.cluster_key())); - - let (events, _) = store.gc(&GarbageCollectionOptions::gc_everything()); - assert_eq!(1, events.len()); - assert!(!events[0].cells.contains_key(&store.cluster_key())); - } - - Ok(()) - } } diff --git a/crates/re_data_store/src/store_format.rs b/crates/re_data_store/src/store_format.rs index b3eb183ceea5d..38a27854bd439 100644 --- a/crates/re_data_store/src/store_format.rs +++ b/crates/re_data_store/src/store_format.rs @@ -11,9 +11,7 @@ impl std::fmt::Display for DataStore { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let Self { id, - cluster_key, config, - cluster_cell_cache: _, type_registry: _, metadata_registry: _, tables, @@ -27,10 +25,6 @@ impl std::fmt::Display for DataStore { f.write_str("DataStore {\n")?; f.write_str(&indent::indent_all_by(4, format!("id: {id}\n")))?; - f.write_str(&indent::indent_all_by( - 4, - format!("cluster_key: {cluster_key:?}\n"), - ))?; f.write_str(&indent::indent_all_by(4, format!("config: {config:?}\n")))?; { @@ -85,7 +79,6 @@ impl std::fmt::Display for IndexedTable { timeline, entity_path, buckets, - cluster_key: _, all_components: _, buckets_num_rows: _, buckets_size_bytes: _, diff --git a/crates/re_data_store/src/store_gc.rs b/crates/re_data_store/src/store_gc.rs index b199b44e99916..a7331bb12fff4 100644 --- a/crates/re_data_store/src/store_gc.rs +++ b/crates/re_data_store/src/store_gc.rs @@ -10,7 +10,7 @@ use re_log_types::{ use re_types_core::{ComponentName, SizeBytes as _}; use crate::{ - store::{ClusterCellCache, IndexedBucketInner, IndexedTable}, + store::{IndexedBucketInner, IndexedTable}, DataStore, DataStoreStats, StoreDiff, StoreDiffKind, StoreEvent, }; @@ -232,9 +232,7 @@ impl DataStore { let mut batch_is_protected = false; let Self { - cluster_key, metadata_registry, - cluster_cell_cache, tables, .. } = self; @@ -254,8 +252,6 @@ impl DataStore { let dropped = Self::drop_batch( options, tables, - cluster_cell_cache, - *cluster_key, &mut num_bytes_to_drop, &batch, batch_is_protected, @@ -297,8 +293,6 @@ impl DataStore { let dropped = Self::drop_batch( options, tables, - cluster_cell_cache, - *cluster_key, &mut num_bytes_to_drop, &batch, batch_is_protected, @@ -341,8 +335,6 @@ impl DataStore { fn drop_batch( options: &GarbageCollectionOptions, tables: &mut BTreeMap<(EntityPathHash, Timeline), IndexedTable>, - cluster_cell_cache: &ClusterCellCache, - cluster_key: ComponentName, num_bytes_to_drop: &mut f64, batch: &[(TimePoint, (EntityPathHash, RowId))], batch_is_protected: bool, @@ -373,8 +365,7 @@ impl DataStore { // NOTE: We _must_ go through all tables no matter what, since the batch might contain // any number of distinct entities. for ((entity_path_hash, _), table) in &mut *tables { - let (removed, num_bytes_removed) = - table.try_drop_bucket(cluster_cell_cache, cluster_key, max_row_id); + let (removed, num_bytes_removed) = table.try_drop_bucket(max_row_id); *num_bytes_to_drop -= num_bytes_removed as f64; @@ -407,8 +398,7 @@ impl DataStore { // find all tables that could possibly contain this `RowId` for (&timeline, &time) in timepoint { if let Some(table) = tables.get_mut(&(*entity_path_hash, timeline)) { - let (removed, num_bytes_removed) = - table.try_drop_row(cluster_cell_cache, *row_id, time); + let (removed, num_bytes_removed) = table.try_drop_row(*row_id, time); if let Some(inner) = diff.as_mut() { if let Some(removed) = removed { inner.times.extend(removed.times); @@ -460,7 +450,6 @@ impl DataStore { let mut components_to_find: HashMap = table .all_components .iter() - .filter(|c| **c != table.cluster_key) .filter(|c| !dont_protect.contains(*c)) .map(|c| (*c, target_count)) .collect(); @@ -506,8 +495,11 @@ impl DataStore { // If any bucket has a non-empty component in any column, we keep it… for bucket in table.buckets.values() { let inner = bucket.inner.read(); - for num in &inner.col_num_instances { - if num.get() != 0 { + for column in inner.columns.values() { + if column + .iter() + .any(|cell| cell.as_ref().map_or(false, |cell| cell.num_instances() > 0)) + { return true; } } @@ -534,7 +526,7 @@ impl DataStore { for column in &mut inner.columns.values_mut() { let cell = column[i].take(); if let Some(cell) = cell { - diff.insert(self.cluster_key, &self.cluster_cell_cache, cell); + diff.insert(cell); } } } @@ -549,12 +541,7 @@ impl DataStore { impl IndexedTable { /// Try to drop an entire bucket at once if it doesn't contain any `RowId` greater than `max_row_id`. - fn try_drop_bucket( - &mut self, - cluster_cache: &ClusterCellCache, - cluster_key: ComponentName, - max_row_id: RowId, - ) -> (Vec, u64) { + fn try_drop_bucket(&mut self, max_row_id: RowId) -> (Vec, u64) { re_tracing::profile_function!(); let entity_path = self.entity_path.clone(); @@ -594,16 +581,6 @@ impl IndexedTable { for (component_name, column) in &mut columns { if let Some(cell) = column.pop_front().flatten() { - if cell.component_name() == cluster_key { - if let Some(cached_cell) = cluster_cache.get(&cell.num_instances()) { - if std::ptr::eq(cell.as_ptr(), cached_cell.as_ptr()) { - // We don't fire events when inserting autogenerated cluster cells, and - // therefore must not fire when removing them either. - continue; - } - } - } - diff.cells.insert(*component_name, cell); } } @@ -630,17 +607,11 @@ impl IndexedTable { /// specified `time`. /// /// Returns how many bytes were actually dropped, or zero if the row wasn't found. - fn try_drop_row( - &mut self, - cluster_cache: &ClusterCellCache, - row_id: RowId, - time: TimeInt, - ) -> (Option, u64) { + fn try_drop_row(&mut self, row_id: RowId, time: TimeInt) -> (Option, u64) { re_tracing::profile_function!(); let entity_path = self.entity_path.clone(); let timeline = self.timeline; - let cluster_key = self.cluster_key; let table_has_more_than_one_bucket = self.buckets.len() > 1; @@ -649,14 +620,7 @@ impl IndexedTable { let (diff, mut dropped_num_bytes) = { let inner = &mut *bucket.inner.write(); - inner.try_drop_row( - cluster_cache, - cluster_key, - row_id, - timeline, - &entity_path, - time, - ) + inner.try_drop_row(row_id, timeline, &entity_path, time) }; // NOTE: We always need to keep at least one bucket alive, otherwise we have @@ -688,8 +652,6 @@ impl IndexedBucketInner { /// Returns how many bytes were actually dropped, or zero if the row wasn't found. fn try_drop_row( &mut self, - cluster_cache: &ClusterCellCache, - cluster_key: ComponentName, row_id: RowId, timeline: Timeline, entity_path: &EntityPath, @@ -704,7 +666,6 @@ impl IndexedBucketInner { col_insert_id, col_row_id, max_row_id, - col_num_instances, columns, size_bytes, } = self; @@ -756,11 +717,6 @@ impl IndexedBucketInner { } } - // col_num_instances - if let Some(num_instances) = col_num_instances.swap_remove(row_index) { - dropped_num_bytes += num_instances.total_size_bytes(); - } - // each data column for column in columns.values_mut() { let cell = column.0.swap_remove(row_index).flatten(); @@ -771,11 +727,10 @@ impl IndexedBucketInner { if let Some(cell) = cell { if let Some(inner) = diff.as_mut() { - inner.insert(cluster_key, cluster_cache, cell); + inner.insert(cell); } else { let mut d = StoreDiff::deletion(removed_row_id, entity_path.clone()); d.at_timestamp(timeline, time); - d.insert(cluster_key, cluster_cache, cell); diff = Some(d); } } @@ -801,22 +756,7 @@ impl IndexedBucketInner { // --- impl StoreDiff { - fn insert( - &mut self, - cluster_key: ComponentName, - cluster_cache: &ClusterCellCache, - cell: DataCell, - ) { - if cell.component_name() == cluster_key { - if let Some(cached_cell) = cluster_cache.get(&cell.num_instances()) { - if std::ptr::eq(cell.as_ptr(), cached_cell.as_ptr()) { - // We don't fire events when inserting of autogenerated cluster cells, and - // therefore must not fire when removing them either. - return; - } - } - } - + fn insert(&mut self, cell: DataCell) { self.cells.insert(cell.component_name(), cell); } } diff --git a/crates/re_data_store/src/store_helpers.rs b/crates/re_data_store/src/store_helpers.rs index d8f07b842cd1e..f98b32c09a559 100644 --- a/crates/re_data_store/src/store_helpers.rs +++ b/crates/re_data_store/src/store_helpers.rs @@ -24,7 +24,6 @@ impl DataStore { RowId::new(), entity_path.clone(), timepoint.clone(), - 1, [component], ) { Ok(row) => row, @@ -64,7 +63,6 @@ impl DataStore { RowId::new(), entity_path.clone(), timepoint.clone(), - cell.num_instances(), cell, ) { Ok(row) => row, diff --git a/crates/re_data_store/src/store_read.rs b/crates/re_data_store/src/store_read.rs index ad83948579e43..392363fe85af0 100644 --- a/crates/re_data_store/src/store_read.rs +++ b/crates/re_data_store/src/store_read.rs @@ -215,10 +215,6 @@ impl DataStore { self.query_id.fetch_add(1, Ordering::Relaxed); let entity_path_hash = entity_path.hash(); - let cluster_comp_pos = component_names - .iter() - .find_position(|component_name| **component_name == self.cluster_key) - .map(|(pos, _)| pos); let Some(primary_comp_pos) = component_names .iter() .find_position(|component_name| **component_name == primary) @@ -233,12 +229,9 @@ impl DataStore { // querying for their temporal data. let mut component_names_opt = [(); N].map(|_| None); for (i, component_name) in component_names.iter().copied().enumerate() { - // TODO(#5303): We let the cluster key slip through for backwards compatibility with - // the legacy instance-key model. This will go away next. - let has_static_data = component_name != self.cluster_key - && static_table.map_or(false, |static_table| { - static_table.cells.contains_key(&component_name) - }); + let has_static_data = static_table.map_or(false, |static_table| { + static_table.cells.contains_key(&component_name) + }); component_names_opt[i] = (!has_static_data).then_some(component_name); } @@ -262,12 +255,6 @@ impl DataStore { if *component_name == primary { data_time = TimeInt::STATIC; max_row_id = RowId::max(max_row_id, static_cell.row_id); - - // TODO(#5303): We let the cluster key slip through for backwards compatibility with - // the legacy instance-key model. This will go away next. - if let Some(cluster_comp_pos) = cluster_comp_pos { - results[cluster_comp_pos] = Some(static_cell.cluster_key.clone()); - } } } } @@ -306,10 +293,6 @@ impl DataStore { self.query_id.fetch_add(1, Ordering::Relaxed); let entity_path_hash = entity_path.hash(); - let cluster_comp_pos = component_names - .iter() - .find_position(|component_name| **component_name == self.cluster_key) - .map(|(pos, _)| pos); let static_table = self.static_tables.get(&entity_path_hash); @@ -317,12 +300,9 @@ impl DataStore { // querying for their temporal data. let mut component_names_opt = [(); N].map(|_| None); for (i, component_name) in component_names.iter().copied().enumerate() { - // TODO(#5303): We let the cluster key slip through for backwards compatibility with - // the legacy instance-key model. This will go away next. - let has_static_data = component_name != self.cluster_key - && static_table.map_or(false, |static_table| { - static_table.cells.contains_key(&component_name) - }); + let has_static_data = static_table.map_or(false, |static_table| { + static_table.cells.contains_key(&component_name) + }); component_names_opt[i] = (!has_static_data).then_some(component_name); } @@ -340,12 +320,6 @@ impl DataStore { // the returned index. if static_cell.row_id > max_row_id { max_row_id = RowId::max(max_row_id, static_cell.row_id); - - // TODO(#5303): We let the cluster key slip through for backwards compatibility with - // the legacy instance-key model. This will go away next. - if let Some(cluster_comp_pos) = cluster_comp_pos { - results[cluster_comp_pos] = Some(static_cell.cluster_key.clone()); - } } } } @@ -602,7 +576,6 @@ impl IndexedBucket { col_insert_id: _, col_row_id, max_row_id: _, - col_num_instances: _, columns, size_bytes: _, } = &*self.inner.read(); @@ -726,7 +699,6 @@ impl IndexedBucket { col_insert_id: _, col_row_id, max_row_id: _, - col_num_instances: _, columns, size_bytes: _, } = &*self.inner.read(); @@ -845,7 +817,6 @@ impl IndexedBucketInner { col_insert_id, col_row_id, max_row_id: _, - col_num_instances, columns, size_bytes: _, } = self; @@ -898,7 +869,6 @@ impl IndexedBucketInner { reshuffle_control_column(col_insert_id, &swaps); } reshuffle_control_column(col_row_id, &swaps); - reshuffle_control_column(col_num_instances, &swaps); } { diff --git a/crates/re_data_store/src/store_sanity.rs b/crates/re_data_store/src/store_sanity.rs index ab11a3bf14a7a..19eab8653ebde 100644 --- a/crates/re_data_store/src/store_sanity.rs +++ b/crates/re_data_store/src/store_sanity.rs @@ -1,6 +1,4 @@ -use re_log_types::{ - DataCellColumn, NumInstances, RowId, TimeInt, TimeRange, VecDequeSortingExt as _, -}; +use re_log_types::{RowId, TimeInt, TimeRange, VecDequeSortingExt as _}; use re_types_core::{ComponentName, Loggable, SizeBytes as _}; use crate::{DataStore, IndexedBucket, IndexedBucketInner, IndexedTable}; @@ -43,12 +41,6 @@ pub enum SanityError { got: u64, }, - #[error("Couldn't find any column for the configured cluster key ('{cluster_key}')")] - ClusterColumnMissing { cluster_key: ComponentName }, - - #[error("The cluster column must be dense, found holes: {cluster_column:?}")] - ClusterColumnSparse { cluster_column: Box }, - #[error("Found overlapping indexed buckets: {t1_max_formatted} ({t1_max}) <-> {t2_max_formatted} ({t2_max})")] OverlappingBuckets { t1_max: i64, @@ -150,11 +142,7 @@ impl IndexedBucket { pub fn sanity_check(&self) -> SanityResult<()> { re_tracing::profile_function!(); - let Self { - timeline: _, - cluster_key, - inner, - } = self; + let Self { timeline: _, inner } = self; { let IndexedBucketInner { @@ -164,7 +152,6 @@ impl IndexedBucket { col_insert_id, col_row_id, max_row_id, - col_num_instances, columns, size_bytes: _, } = &*inner.read(); @@ -216,7 +203,6 @@ impl IndexedBucket { .then(|| (DataStore::insert_id_component_name(), col_insert_id.len())), // Some((COLUMN_TIMEPOINT.into(), col_time.len())), Some((RowId::name(), col_row_id.len())), - Some((NumInstances::name(), col_num_instances.len())), ] .into_iter() .flatten() @@ -237,21 +223,6 @@ impl IndexedBucket { } } } - - // The cluster column must be fully dense. - if self.num_rows() > 0 { - let cluster_column = - columns - .get(cluster_key) - .ok_or(SanityError::ClusterColumnMissing { - cluster_key: *cluster_key, - })?; - if !cluster_column.iter().all(|cell| cell.is_some()) { - return Err(SanityError::ClusterColumnSparse { - cluster_column: cluster_column.clone().into(), - }); - } - } } // Make sure size values aren't out of sync diff --git a/crates/re_data_store/src/store_stats.rs b/crates/re_data_store/src/store_stats.rs index 64dde26eac727..f960a4174d11c 100644 --- a/crates/re_data_store/src/store_stats.rs +++ b/crates/re_data_store/src/store_stats.rs @@ -1,10 +1,7 @@ use re_log_types::{EntityPathHash, TimePoint, TimeRange}; use re_types_core::SizeBytes; -use crate::{ - store::IndexedBucketInner, ClusterCellCache, DataStore, IndexedBucket, IndexedTable, - MetadataRegistry, -}; +use crate::{store::IndexedBucketInner, DataStore, IndexedBucket, IndexedTable, MetadataRegistry}; // --- @@ -44,8 +41,6 @@ pub struct DataStoreStats { pub type_registry: DataStoreRowStats, pub metadata_registry: DataStoreRowStats, - pub autogenerated: DataStoreRowStats, - /// `num_rows` is really `num_cells` in this case. pub static_tables: DataStoreRowStats, @@ -62,7 +57,6 @@ impl std::ops::Sub for DataStoreStats { Self { type_registry: self.type_registry - rhs.type_registry, metadata_registry: self.metadata_registry - rhs.metadata_registry, - autogenerated: self.autogenerated - rhs.autogenerated, static_tables: self.static_tables - rhs.static_tables, temporal: self.temporal - rhs.temporal, temporal_buckets: self.temporal_buckets - rhs.temporal_buckets, @@ -78,7 +72,6 @@ impl std::ops::Add for DataStoreStats { Self { type_registry: self.type_registry + rhs.type_registry, metadata_registry: self.metadata_registry + rhs.metadata_registry, - autogenerated: self.autogenerated + rhs.autogenerated, static_tables: self.static_tables + rhs.static_tables, temporal: self.temporal + rhs.temporal, temporal_buckets: self.temporal_buckets + rhs.temporal_buckets, @@ -107,14 +100,6 @@ impl DataStoreStats { } }; - let autogenerated = { - re_tracing::profile_scope!("autogenerated"); - DataStoreRowStats { - num_rows: store.cluster_cell_cache.len() as _, - num_bytes: store.cluster_cell_cache.total_size_bytes(), - } - }; - let static_tables = { re_tracing::profile_scope!("static data"); DataStoreRowStats { @@ -138,7 +123,6 @@ impl DataStoreStats { num_rows: static_tables.num_rows + temporal.num_rows, num_bytes: type_registry.num_bytes + metadata_registry.num_bytes - + autogenerated.num_bytes + static_tables.num_bytes + temporal.num_bytes, }; @@ -146,7 +130,6 @@ impl DataStoreStats { Self { type_registry, metadata_registry, - autogenerated, static_tables, temporal, temporal_buckets, @@ -175,13 +158,6 @@ impl SizeBytes for MetadataRegistry<(TimePoint, EntityPathHash)> { } } -impl SizeBytes for ClusterCellCache { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } -} - impl SizeBytes for DataStore { #[inline] fn heap_size_bytes(&self) -> u64 { @@ -392,7 +368,6 @@ impl IndexedBucketInner { col_insert_id, col_row_id, max_row_id, - col_num_instances, columns, size_bytes, } = self; @@ -403,7 +378,6 @@ impl IndexedBucketInner { + col_insert_id.total_size_bytes() + col_row_id.total_size_bytes() + max_row_id.total_size_bytes() - + col_num_instances.total_size_bytes() + columns.total_size_bytes() + size_bytes.total_size_bytes(); diff --git a/crates/re_data_store/src/store_subscriber.rs b/crates/re_data_store/src/store_subscriber.rs index 51bba35288705..f56264164bfe0 100644 --- a/crates/re_data_store/src/store_subscriber.rs +++ b/crates/re_data_store/src/store_subscriber.rs @@ -156,10 +156,9 @@ mod tests { use ahash::HashSet; use re_log_types::{ - example_components::{MyColor, MyPoint}, + example_components::{MyColor, MyIndex, MyPoint}, DataRow, RowId, StoreId, TimePoint, Timeline, }; - use re_types_core::{components::InstanceKey, Loggable as _}; use crate::{DataStore, GarbageCollectionOptions, StoreSubscriber}; @@ -209,12 +208,10 @@ mod tests { fn store_subscriber() -> anyhow::Result<()> { let mut store1 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut store2 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -235,7 +232,7 @@ mod tests { (timeline_yet_another, 1), // ]), "entity_a".into(), - [&InstanceKey::from_iter(0..10) as _], + [&MyIndex::from_iter(0..10) as _], )?; expected_events.extend(store1.insert_row(&row)); @@ -267,7 +264,7 @@ mod tests { TimePoint::default(), "entity_b".into(), [ - &InstanceKey::from_iter(0..num_instances as _) as _, + &MyIndex::from_iter(0..num_instances as _) as _, &colors as _, ], )? diff --git a/crates/re_data_store/src/store_write.rs b/crates/re_data_store/src/store_write.rs index b340d2f64b296..d1b3347f77e48 100644 --- a/crates/re_data_store/src/store_write.rs +++ b/crates/re_data_store/src/store_write.rs @@ -8,9 +8,7 @@ use re_log_types::{ DataCell, DataCellColumn, DataCellError, DataRow, EntityPathHash, RowId, TimeInt, TimePoint, TimeRange, VecDequeRemovalExt as _, }; -use re_types_core::{ - components::InstanceKey, ComponentName, ComponentNameSet, Loggable, SizeBytes as _, -}; +use re_types_core::{ComponentName, ComponentNameSet, SizeBytes as _}; use crate::{ DataStore, DataStoreConfig, IndexedBucket, IndexedBucketInner, IndexedTable, MetadataRegistry, @@ -27,15 +25,6 @@ pub enum WriteError { #[error("Error with one or more the underlying data cells")] DataCell(#[from] DataCellError), - #[error("The cluster component must be dense, got {0:?}")] - SparseClusteringComponent(DataCell), - - #[error( - "The cluster component must be increasingly sorted and not contain \ - any duplicates, got {0:?}" - )] - InvalidClusteringComponent(DataCell), - #[error("The inserted data must contain at least one cell")] Empty, @@ -56,10 +45,6 @@ pub type WriteResult = ::std::result::Result; impl DataStore { /// Inserts a [`DataRow`]'s worth of components into the datastore. - /// - /// If the bundle doesn't carry a payload for the cluster key, one will be auto-generated - /// based on the length of the components in the payload, in the form of an array of - /// monotonically increasing `u64`s going from `0` to `N-1`. pub fn insert_row(&mut self, row: &DataRow) -> WriteResult { // TODO(cmc): kind & insert_id need to somehow propagate through the span system. self.insert_id += 1; @@ -72,7 +57,6 @@ impl DataStore { row_id, timepoint, entity_path, - num_instances, cells, } = row; @@ -90,12 +74,10 @@ impl DataStore { } let entity_path_hash = entity_path.hash(); - let num_instances = *num_instances; trace!( kind = "insert", id = self.insert_id, - cluster_key = %self.cluster_key, timelines = ?timepoint.iter() .map(|(timeline, time)| (timeline.name(), timeline.typ().format_utc(*time))) .collect::>(), @@ -104,46 +86,14 @@ impl DataStore { "insertion started…" ); - let cluster_cell_pos = cells - .iter() - .find_position(|cell| cell.component_name() == self.cluster_key) - .map(|(pos, _)| pos); - - let generated_cluster_cell = if let Some(cluster_cell_pos) = cluster_cell_pos { - // We found a column with a name matching the cluster key's, let's make sure it's - // valid (dense, sorted, no duplicates) and use that if so. - - let cluster_cell = &cells[cluster_cell_pos]; - - // Clustering component must be dense. - if !cluster_cell.is_dense() { - return Err(WriteError::SparseClusteringComponent(cluster_cell.clone())); - } - // Clustering component must be sorted and not contain any duplicates. - if !cluster_cell.is_sorted_and_unique()? { - return Err(WriteError::InvalidClusteringComponent(cluster_cell.clone())); - } - - None - } else { - // The caller has not specified any cluster component, and so we'll have to generate - // one… unless we've already generated one of this exact length in the past, - // in which case we can simply re-use that cell. - - let (cell, _) = self.generate_cluster_cell(num_instances.into()); - - Some(cell) - }; - let insert_id = self.config.store_insert_ids.then_some(self.insert_id); let diff = if timepoint.is_static() { let static_table = self .static_tables .entry(entity_path_hash) - .or_insert_with(|| StaticTable::new(self.cluster_key, entity_path.clone())); + .or_insert_with(|| StaticTable::new(entity_path.clone())); - let cluster_key = self.cluster_key; let cells = row .cells() .iter() @@ -156,25 +106,13 @@ impl DataStore { }) .collect_vec(); - for cell in cells - .iter() - // TODO(#5303): We let the cluster key slip through for backwards compatibility with - // the legacy instance-key model. This will go away next. - .filter(|cell| cell.component_name() != cluster_key) - { + for cell in &cells { static_table.cells.insert( cell.component_name(), StaticCell { insert_id, row_id: *row_id, - num_instances, cell: (*cell).clone(), - // TODO(#5303): We keep track of cluster keys for each static cell for backwards - // compatibility with the legacy instance-key model. This will go away next. - cluster_key: generated_cluster_cell - .as_ref() - .unwrap_or_else(|| cells[cluster_cell_pos.unwrap()]) - .clone(), }, ); } @@ -188,15 +126,9 @@ impl DataStore { let index = self .tables .entry((entity_path_hash, *timeline)) - .or_insert_with(|| IndexedTable::new(self.cluster_key, *timeline, entity_path)); - - index.insert_row( - &self.config, - insert_id, - *time, - generated_cluster_cell.clone(), /* shallow */ - row, - ); + .or_insert_with(|| IndexedTable::new(*timeline, entity_path)); + + index.insert_row(&self.config, insert_id, *time, row); } let mut diff = StoreDiff::addition(*row_id, entity_path.clone()); @@ -205,11 +137,6 @@ impl DataStore { diff }; - // TODO(#4220): should we fire for auto-generated data? - // if let Some(cell) = generated_cluster_cell { - // diff = diff.with_cells([cell]); - // } - let event = StoreEvent { store_id: self.id.clone(), store_generation: self.generation(), @@ -233,35 +160,6 @@ impl DataStore { Ok(event) } - - /// Auto-generates an appropriate cluster cell for the specified number of instances and - /// transparently handles caching. - /// - /// Returns `true` if the cell was returned from cache. - // TODO(#1777): shared slices for auto generated keys - fn generate_cluster_cell(&mut self, num_instances: u32) -> (DataCell, bool) { - re_tracing::profile_function!(); - - if let Some(cell) = self.cluster_cell_cache.get(&num_instances) { - // Cache hit! - - (cell.clone(), true) - } else { - // Cache miss! Craft a new instance keys from the ground up. - - // …so we create it manually instead. - let values = - arrow2::array::UInt64Array::from_vec((0..num_instances as u64).collect_vec()) - .boxed(); - let mut cell = DataCell::from_arrow(InstanceKey::name(), values); - cell.compute_size_bytes(); - - self.cluster_cell_cache - .insert(num_instances, cell.clone() /* shallow */); - - (cell, false) - } - } } impl MetadataRegistry<(TimePoint, EntityPathHash)> { @@ -291,7 +189,6 @@ impl IndexedTable { config: &DataStoreConfig, insert_id: Option, time: TimeInt, - generated_cluster_cell: Option, row: &DataRow, ) { re_tracing::profile_function!(); @@ -326,7 +223,7 @@ impl IndexedTable { self.buckets_size_bytes -= bucket_size_before; self.buckets.insert(min, second_half); - return self.insert_row(config, insert_id, time, generated_cluster_cell, row); + return self.insert_row(config, insert_id, time, row); } // We couldn't split the bucket, either because it's already too small, or because it @@ -383,13 +280,12 @@ impl IndexedTable { TimeInt::new_temporal(new_time_bound), IndexedBucket { timeline, - cluster_key: self.cluster_key, inner: RwLock::new(inner), }, ); self.buckets_size_bytes += inner_size_bytes; - return self.insert_row(config, insert_id, time, generated_cluster_cell, row); + return self.insert_row(config, insert_id, time, row); } } @@ -420,8 +316,7 @@ impl IndexedTable { "inserted into indexed tables" ); - let size_bytes = - bucket.insert_row(insert_id, time, generated_cluster_cell, row, &components); + let size_bytes = bucket.insert_row(insert_id, time, row, &components); self.buckets_size_bytes += size_bytes; self.buckets_num_rows += 1; @@ -436,14 +331,13 @@ impl IndexedBucket { &mut self, insert_id: Option, time: TimeInt, - generated_cluster_cell: Option, row: &DataRow, components: &ComponentNameSet, ) -> u64 { re_tracing::profile_function!(); let mut size_bytes_added = 0u64; - let num_rows = self.num_rows() as usize; + let _num_rows = self.num_rows() as usize; let mut inner = self.inner.write(); let IndexedBucketInner { @@ -453,7 +347,6 @@ impl IndexedBucket { col_insert_id, col_row_id, max_row_id, - col_num_instances, columns, size_bytes, } = &mut *inner; @@ -477,21 +370,6 @@ impl IndexedBucket { col_row_id.push_back(row.row_id()); *max_row_id = RowId::max(*max_row_id, row.row_id()); size_bytes_added += row.row_id().total_size_bytes(); - col_num_instances.push_back(row.num_instances()); - size_bytes_added += row.num_instances().total_size_bytes(); - - // insert auto-generated cluster cell if present - if let Some(cluster_cell) = generated_cluster_cell { - let component_name = cluster_cell.component_name(); - let column = columns.entry(component_name).or_insert_with(|| { - let column = DataCellColumn::empty(num_rows); - size_bytes_added += component_name.total_size_bytes(); - size_bytes_added += column.total_size_bytes(); - column - }); - size_bytes_added += cluster_cell.total_size_bytes(); - column.0.push_back(Some(cluster_cell.clone())); - } // append components to their respective columns (2-way merge) @@ -512,11 +390,6 @@ impl IndexedBucket { // // fill unimpacted columns with null values for (component_name, column) in &mut *columns { - // The cluster key always gets added one way or another, don't try to force fill it! - if *component_name == self.cluster_key { - continue; - } - if !components.contains(component_name) { let none_cell: Option = None; size_bytes_added += none_cell.total_size_bytes(); @@ -559,11 +432,7 @@ impl IndexedBucket { /// cargo test -p re_data_store -- --nocapture datastore_internal_repr /// ``` fn split(&self) -> Option<(TimeInt, Self)> { - let Self { - timeline, - cluster_key: _, - inner, - } = self; + let Self { timeline, inner } = self; let mut inner1 = inner.write(); @@ -588,7 +457,6 @@ impl IndexedBucket { col_insert_id: col_insert_id1, col_row_id: col_row_id1, max_row_id: max_row_id1, - col_num_instances: col_num_instances1, columns: columns1, size_bytes: _, // NOTE: recomputed below } = &mut *inner1; @@ -605,7 +473,7 @@ impl IndexedBucket { }; let split_idx = find_split_index(times1).expect("must be splittable at this point"); - let (time_range2, col_time2, col_insert_id2, col_row_id2, col_num_instances2) = { + let (time_range2, col_time2, col_insert_id2, col_row_id2) = { re_tracing::profile_scope!("control"); // update everything _in place_! ( @@ -613,7 +481,6 @@ impl IndexedBucket { col_time1.split_off_or_default(split_idx), col_insert_id1.split_off_or_default(split_idx), col_row_id1.split_off_or_default(split_idx), - col_num_instances1.split_off_or_default(split_idx), ) }; // NOTE: We _have_ to fullscan here: the bucket is sorted by `(Time, RowId)`, there @@ -648,7 +515,6 @@ impl IndexedBucket { col_insert_id: col_insert_id2, col_row_id: col_row_id2, max_row_id: max_row_id2, - col_num_instances: col_num_instances2, columns: columns2, size_bytes: 0, // NOTE: computed below }; @@ -657,7 +523,6 @@ impl IndexedBucket { }; let bucket2 = Self { timeline, - cluster_key: self.cluster_key, inner: RwLock::new(inner2), }; diff --git a/crates/re_data_store/src/test_util.rs b/crates/re_data_store/src/test_util.rs index 50c568d4a943e..f928c4f455a6b 100644 --- a/crates/re_data_store/src/test_util.rs +++ b/crates/re_data_store/src/test_util.rs @@ -7,32 +7,29 @@ use crate::{DataStore, DataStoreConfig, WriteError}; #[doc(hidden)] #[macro_export] macro_rules! test_row { - ($entity:ident => $n:expr; [$c0:expr $(,)*]) => {{ + ($entity:ident => [$c0:expr $(,)*]) => {{ ::re_log_types::DataRow::from_cells1_sized( ::re_log_types::RowId::new(), $entity.clone(), ::re_log_types::TimePoint::default(), - $n, $c0, ) .unwrap() }}; - ($entity:ident @ $frames:tt => $n:expr; [$c0:expr $(,)*]) => {{ + ($entity:ident @ $frames:tt => [$c0:expr $(,)*]) => {{ ::re_log_types::DataRow::from_cells1_sized( ::re_log_types::RowId::new(), $entity.clone(), $frames, - $n, $c0, ) .unwrap() }}; - ($entity:ident @ $frames:tt => $n:expr; [$c0:expr, $c1:expr $(,)*]) => {{ + ($entity:ident @ $frames:tt => [$c0:expr, $c1:expr $(,)*]) => {{ ::re_log_types::DataRow::from_cells2_sized( ::re_log_types::RowId::new(), $entity.clone(), $frames, - $n, ($c0, $c1), ) .unwrap() diff --git a/crates/re_data_store/tests/correctness.rs b/crates/re_data_store/tests/correctness.rs index 2d75cf1a69c04..89119b663c15c 100644 --- a/crates/re_data_store/tests/correctness.rs +++ b/crates/re_data_store/tests/correctness.rs @@ -8,13 +8,12 @@ use re_data_store::{ test_row, test_util::sanity_unwrap, DataStore, DataStoreConfig, DataStoreStats, GarbageCollectionOptions, LatestAtQuery, WriteError, }; -use re_log_types::example_components::MyPoint; +use re_log_types::example_components::{MyIndex, MyPoint}; use re_log_types::{ - build_frame_nr, build_log_time, DataCell, DataRow, Duration, EntityPath, RowId, Time, TimeInt, - TimePoint, TimeType, Timeline, + build_frame_nr, build_log_time, DataRow, Duration, EntityPath, RowId, Time, TimeInt, TimePoint, + TimeType, Timeline, }; -use re_types::components::InstanceKey; -use re_types::datagen::{build_some_colors, build_some_instances, build_some_positions2d}; +use re_types::datagen::{build_some_colors, build_some_positions2d}; use re_types_core::Loggable as _; // --- @@ -54,7 +53,6 @@ fn row_id_ordering_semantics() -> anyhow::Result<()> { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -89,7 +87,6 @@ fn row_id_ordering_semantics() -> anyhow::Result<()> { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -120,7 +117,6 @@ fn row_id_ordering_semantics() -> anyhow::Result<()> { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -160,7 +156,6 @@ fn row_id_ordering_semantics() -> anyhow::Result<()> { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -202,73 +197,16 @@ fn write_errors() { let entity_path = EntityPath::from("this/that"); - { - pub fn build_sparse_instances() -> DataCell { - DataCell::from_component_sparse::([Some(1), None, Some(3)]) - } - - let mut store = DataStore::new( - re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), - Default::default(), - ); - let row = test_row!(entity_path @ - [build_frame_nr(32), build_log_time(Time::now())] => 3; [ - build_sparse_instances(), build_some_positions2d(3) - ]); - assert!(matches!( - store.insert_row(&row), - Err(WriteError::SparseClusteringComponent(_)), - )); - } - - { - pub fn build_unsorted_instances() -> DataCell { - DataCell::from_component::([1, 3, 2]) - } - - pub fn build_duped_instances() -> DataCell { - DataCell::from_component::([1, 2, 2]) - } - - let mut store = DataStore::new( - re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), - Default::default(), - ); - { - let row = test_row!(entity_path @ - [build_frame_nr(32), build_log_time(Time::now())] => 3; [ - build_unsorted_instances(), build_some_positions2d(3) - ]); - assert!(matches!( - store.insert_row(&row), - Err(WriteError::InvalidClusteringComponent(_)), - )); - } - { - let row = test_row!(entity_path @ - [build_frame_nr(32), build_log_time(Time::now())] => 3; [ - build_duped_instances(), build_some_positions2d(3) - ]); - assert!(matches!( - store.insert_row(&row), - Err(WriteError::InvalidClusteringComponent(_)), - )); - } - } - { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut row = test_row!(entity_path @ [ build_frame_nr(1), build_log_time(Time::now()), - ] => 1; [ build_some_positions2d(1) ]); + ] => [ build_some_positions2d(1) ]); row.row_id = re_log_types::RowId::new(); store.insert_row(&row).unwrap(); @@ -298,7 +236,6 @@ fn latest_at_emptiness_edge_cases() { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); latest_at_emptiness_edge_cases_impl(&mut store); @@ -317,7 +254,7 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { store .insert_row(&test_row!(entity_path @ [ build_log_time(now), build_frame_nr(frame40), - ] => num_instances; [build_some_instances(num_instances as _)])) + ] => [MyIndex::from_iter(0..num_instances as _)])) .unwrap(); sanity_unwrap(store); @@ -332,8 +269,8 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_frame_nr, frame39), &entity_path, - InstanceKey::name(), - &[InstanceKey::name()], + MyIndex::name(), + &[MyIndex::name()], ); assert!(cells.is_none()); } @@ -343,8 +280,8 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_log_time, now_minus_1s_nanos), &entity_path, - InstanceKey::name(), - &[InstanceKey::name()], + MyIndex::name(), + &[MyIndex::name()], ); assert!(cells.is_none()); } @@ -354,8 +291,8 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_frame_nr, frame40), &EntityPath::from("does/not/exist"), - InstanceKey::name(), - &[InstanceKey::name()], + MyIndex::name(), + &[MyIndex::name()], ); assert!(cells.is_none()); } @@ -366,7 +303,7 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_frame_nr, frame40), &entity_path, - InstanceKey::name(), + MyIndex::name(), components, ); assert!(cells.is_none()); @@ -377,7 +314,7 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_frame_nr, frame40), &entity_path, - InstanceKey::name(), + MyIndex::name(), &[], ); assert!(cells.is_none()); @@ -388,8 +325,8 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_wrong_name, frame40), &EntityPath::from("does/not/exist"), - InstanceKey::name(), - &[InstanceKey::name()], + MyIndex::name(), + &[MyIndex::name()], ); assert!(cells.is_none()); } @@ -399,8 +336,8 @@ fn latest_at_emptiness_edge_cases_impl(store: &mut DataStore) { let cells = store.latest_at( &LatestAtQuery::new(timeline_wrong_kind, frame40), &EntityPath::from("does/not/exist"), - InstanceKey::name(), - &[InstanceKey::name()], + MyIndex::name(), + &[MyIndex::name()], ); assert!(cells.is_none()); } @@ -414,7 +351,6 @@ fn gc_correct() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig::default(), ); @@ -431,7 +367,7 @@ fn gc_correct() { let num_instances = rng.gen_range(0..=1_000); let row = test_row!(entity_path @ [ build_frame_nr(frame_nr), - ] => num_instances; [ + ] => [ build_some_colors(num_instances as _), ]); store.insert_row(&row).unwrap(); @@ -481,7 +417,6 @@ fn gc_metadata_size() -> anyhow::Result<()> { for enable_batching in [false, true] { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); @@ -529,7 +464,6 @@ fn entity_min_time_correct() -> anyhow::Result<()> { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); entity_min_time_correct_impl(&mut store)?; diff --git a/crates/re_data_store/tests/data_store.rs b/crates/re_data_store/tests/data_store.rs index 2a67aeb307ed4..27f8ccd1f4920 100644 --- a/crates/re_data_store/tests/data_store.rs +++ b/crates/re_data_store/tests/data_store.rs @@ -10,15 +10,16 @@ use re_data_store::{ DataStore, DataStoreConfig, DataStoreStats, GarbageCollectionOptions, GarbageCollectionTarget, LatestAtQuery, RangeQuery, TimeInt, TimeRange, }; -use re_log_types::{build_frame_nr, DataRow, DataTable, EntityPath, TableId, TimeType, Timeline}; +use re_log_types::{ + build_frame_nr, example_components::MyIndex, DataRow, DataTable, EntityPath, TableId, TimeType, + Timeline, +}; use re_types::{ - components::{Color, InstanceKey, Position2D}, + components::{Color, Position2D}, testing::{build_some_large_structs, LargeStruct}, }; use re_types::{ - datagen::{ - build_some_colors, build_some_instances, build_some_instances_from, build_some_positions2d, - }, + datagen::{build_some_colors, build_some_positions2d}, ComponentNameSet, }; use re_types_core::{ComponentName, Loggable as _}; @@ -41,7 +42,6 @@ fn all_components() { // Stress test save-to-disk & load-from-disk let mut store2 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - store.cluster_key(), store.config().clone(), ); for table in store.to_data_tables(None) { @@ -75,39 +75,35 @@ fn all_components() { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig { indexed_bucket_num_rows: u64::MAX, ..Default::default() }, ); - let cluster_key = store.cluster_key(); let components_a = &[ Color::name(), // added by test, static LargeStruct::name(), // added by test - cluster_key, // always here ]; let components_b = &[ Color::name(), // added by test, static Position2D::name(), // added by test LargeStruct::name(), // added by test - cluster_key, // always here ]; - let row = test_row!(entity_path => 2; [build_some_colors(2)]); + let row = test_row!(entity_path => [build_some_colors(2)]); store.insert_row(&row).unwrap(); let row = - test_row!(entity_path @ [build_frame_nr(frame1)] => 2; [build_some_large_structs(2)]); + test_row!(entity_path @ [build_frame_nr(frame1)] => [build_some_large_structs(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_a)); let row = test_row!(entity_path @ [ build_frame_nr(frame2), - ] => 2; [build_some_large_structs(2), build_some_positions2d(2)]); + ] => [build_some_large_structs(2), build_some_positions2d(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_b)); @@ -119,13 +115,11 @@ fn all_components() { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig { indexed_bucket_num_rows: 0, ..Default::default() }, ); - let cluster_key = store.cluster_key(); // ┌──────────┬─────────────┬────────┬───────────┬──────────┐ // │ frame_nr ┆ LargeStruct ┆ row_id ┆ insert_id ┆ instance │ @@ -143,32 +137,29 @@ fn all_components() { let components_a = &[ Color::name(), // added by test, static LargeStruct::name(), // added by test - cluster_key, // always here ]; let components_b = &[ Color::name(), // added by test, static LargeStruct::name(), // ⚠ inherited before the buckets got split apart! Position2D::name(), // added by test - cluster_key, // always here ]; - let row = test_row!(entity_path => 2; [build_some_colors(2)]); + let row = test_row!(entity_path => [build_some_colors(2)]); store.insert_row(&row).unwrap(); let row = - test_row!(entity_path @ [build_frame_nr(frame1)] => 2; [build_some_large_structs(2)]); + test_row!(entity_path @ [build_frame_nr(frame1)] => [build_some_large_structs(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_a)); - let row = test_row!(entity_path @ [build_frame_nr(frame2)] => 2; [build_some_instances(2)]); + let row = test_row!(entity_path @ [build_frame_nr(frame2)] => [MyIndex::from_iter(0..2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_a)); - let row = - test_row!(entity_path @ [build_frame_nr(frame3)] => 2; [build_some_positions2d(2)]); + let row = test_row!(entity_path @ [build_frame_nr(frame3)] => [build_some_positions2d(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_b)); @@ -181,13 +172,11 @@ fn all_components() { { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig { indexed_bucket_num_rows: 0, ..Default::default() }, ); - let cluster_key = store.cluster_key(); // ┌──────────┬─────────────┬─────────┬────────┬───────────┬──────────┐ // │ frame_nr ┆ LargeStruct ┆ point2d ┆ row_id ┆ insert_id ┆ instance │ @@ -207,39 +196,36 @@ fn all_components() { let components_a = &[ Color::name(), // added by test, static LargeStruct::name(), // added by test - cluster_key, // always here ]; let components_b = &[ Color::name(), // added by test, static Position2D::name(), // added by test but not contained in the second bucket LargeStruct::name(), // added by test - cluster_key, // always here ]; - let row = test_row!(entity_path => 2; [build_some_colors(2)]); + let row = test_row!(entity_path => [build_some_colors(2)]); store.insert_row(&row).unwrap(); let row = - test_row!(entity_path @ [build_frame_nr(frame2)] => 2; [build_some_large_structs(2)]); + test_row!(entity_path @ [build_frame_nr(frame2)] => [build_some_large_structs(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_a)); let row = - test_row!(entity_path @ [build_frame_nr(frame3)] => 2; [build_some_large_structs(2)]); + test_row!(entity_path @ [build_frame_nr(frame3)] => [build_some_large_structs(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_a)); let row = - test_row!(entity_path @ [build_frame_nr(frame4)] => 2; [build_some_large_structs(2)]); + test_row!(entity_path @ [build_frame_nr(frame4)] => [build_some_large_structs(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_a)); - let row = - test_row!(entity_path @ [build_frame_nr(frame1)] => 2; [build_some_positions2d(2)]); + let row = test_row!(entity_path @ [build_frame_nr(frame1)] => [build_some_positions2d(2)]); store.insert_row(&row).unwrap(); assert_latest_components_at(&mut store, &entity_path, Some(components_b)); @@ -257,7 +243,6 @@ fn latest_at() { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); latest_at_impl(&mut store); @@ -275,22 +260,21 @@ fn latest_at_impl(store: &mut DataStore) { let frame3 = TimeInt::new_temporal(3); let frame4 = TimeInt::new_temporal(4); - let (instances1, colors1) = (build_some_instances(3), build_some_colors(3)); - let row1 = - test_row!(entity_path @ [build_frame_nr(frame1)] => 3; [instances1.clone(), colors1]); + let (instances1, colors1) = (MyIndex::from_iter(0..3), build_some_colors(3)); + let row1 = test_row!(entity_path @ [build_frame_nr(frame1)] => [instances1.clone(), colors1]); let positions2 = build_some_positions2d(3); - let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => 3; [instances1, positions2]); + let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => [instances1, positions2]); let points3 = build_some_positions2d(10); - let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => 10; [points3]); + let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => [points3]); let colors4 = build_some_colors(5); - let row4 = test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [colors4]); + let row4 = test_row!(entity_path @ [build_frame_nr(frame4)] => [colors4]); // injecting some static colors let colors5 = build_some_colors(3); - let row5 = test_row!(entity_path => 5; [colors5]); + let row5 = test_row!(entity_path => [colors5]); insert_table_with_retries( store, @@ -309,7 +293,6 @@ fn latest_at_impl(store: &mut DataStore) { // Stress test save-to-disk & load-from-disk let mut store2 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - store.cluster_key(), store.config().clone(), ); for table in store.to_data_tables(None) { @@ -382,7 +365,6 @@ fn range() { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); range_impl(&mut store); @@ -400,39 +382,37 @@ fn range_impl(store: &mut DataStore) { let frame4 = TimeInt::new_temporal(4); let frame5 = TimeInt::new_temporal(5); - let insts1 = build_some_instances(3); + let insts1 = MyIndex::from_iter(0..3); let colors1 = build_some_colors(3); - let row1 = test_row!(entity_path @ [build_frame_nr(frame1)] => 3; [insts1.clone(), colors1]); + let row1 = test_row!(entity_path @ [build_frame_nr(frame1)] => [insts1.clone(), colors1]); let positions2 = build_some_positions2d(3); - let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => 3; [insts1, positions2]); + let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => [insts1, positions2]); let points3 = build_some_positions2d(10); - let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => 10; [points3]); + let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => [points3]); - let insts4_1 = build_some_instances_from(20..25); + let insts4_1 = MyIndex::from_iter(20..25); let colors4_1 = build_some_colors(5); - let row4_1 = test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [insts4_1, colors4_1]); + let row4_1 = test_row!(entity_path @ [build_frame_nr(frame4)] => [insts4_1, colors4_1]); - let insts4_2 = build_some_instances_from(25..30); + let insts4_2 = MyIndex::from_iter(25..30); let colors4_2 = build_some_colors(5); - let row4_2 = - test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [insts4_2.clone(), colors4_2]); + let row4_2 = test_row!(entity_path @ [build_frame_nr(frame4)] => [insts4_2.clone(), colors4_2]); let points4_25 = build_some_positions2d(5); - let row4_25 = test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [insts4_2, points4_25]); + let row4_25 = test_row!(entity_path @ [build_frame_nr(frame4)] => [insts4_2, points4_25]); - let insts4_3 = build_some_instances_from(30..35); + let insts4_3 = MyIndex::from_iter(30..35); let colors4_3 = build_some_colors(5); - let row4_3 = - test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [insts4_3.clone(), colors4_3]); + let row4_3 = test_row!(entity_path @ [build_frame_nr(frame4)] => [insts4_3.clone(), colors4_3]); let points4_4 = build_some_positions2d(5); - let row4_4 = test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [insts4_3, points4_4]); + let row4_4 = test_row!(entity_path @ [build_frame_nr(frame4)] => [insts4_3, points4_4]); // injecting some static colors let colors5 = build_some_colors(8); - let row5 = test_row!(entity_path => 8; [colors5]); + let row5 = test_row!(entity_path => [colors5]); insert_table_with_retries( store, @@ -466,7 +446,6 @@ fn range_impl(store: &mut DataStore) { // Stress test save-to-disk & load-from-disk let mut store2 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - store.cluster_key(), store.config().clone(), ); for table in store.to_data_tables(None) { @@ -590,7 +569,6 @@ fn gc() { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); gc_impl(&mut store); @@ -611,7 +589,7 @@ fn gc_impl(store: &mut DataStore) { let num_instances = rng.gen_range(0..=1_000); let row = test_row!(entity_path @ [ build_frame_nr(frame_nr) - ] => num_instances; [ + ] => [ build_some_large_structs(num_instances as _), ]); store.insert_row(&row).unwrap(); @@ -660,7 +638,6 @@ fn protected_gc() { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); protected_gc_impl(&mut store); @@ -677,18 +654,17 @@ fn protected_gc_impl(store: &mut DataStore) { let frame3 = TimeInt::new_temporal(3); let frame4 = TimeInt::new_temporal(4); - let (instances1, colors1) = (build_some_instances(3), build_some_colors(3)); - let row1 = - test_row!(entity_path @ [build_frame_nr(frame1)] => 3; [instances1.clone(), colors1]); + let (instances1, colors1) = (MyIndex::from_iter(0..3), build_some_colors(3)); + let row1 = test_row!(entity_path @ [build_frame_nr(frame1)] => [instances1.clone(), colors1]); let positions2 = build_some_positions2d(3); - let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => 3; [instances1, positions2]); + let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => [instances1, positions2]); let points3 = build_some_positions2d(10); - let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => 10; [points3]); + let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => [points3]); let colors4 = build_some_colors(5); - let row4 = test_row!(entity_path @ [build_frame_nr(frame4)] => 5; [colors4]); + let row4 = test_row!(entity_path @ [build_frame_nr(frame4)] => [colors4]); store.insert_row(&row1).unwrap(); store.insert_row(&row2).unwrap(); @@ -763,7 +739,6 @@ fn protected_gc_clear() { for config in re_data_store::test_util::all_configs() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); protected_gc_clear_impl(&mut store); @@ -781,18 +756,17 @@ fn protected_gc_clear_impl(store: &mut DataStore) { let frame3 = TimeInt::new_temporal(3); let frame4 = TimeInt::new_temporal(4); - let (instances1, colors1) = (build_some_instances(3), build_some_colors(3)); - let row1 = - test_row!(entity_path @ [build_frame_nr(frame1)] => 3; [instances1.clone(), colors1]); + let (instances1, colors1) = (MyIndex::from_iter(0..3), build_some_colors(3)); + let row1 = test_row!(entity_path @ [build_frame_nr(frame1)] => [instances1.clone(), colors1]); let positions2 = build_some_positions2d(3); - let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => 3; [instances1, positions2]); + let row2 = test_row!(entity_path @ [build_frame_nr(frame2)] => [instances1, positions2]); let colors2 = build_some_colors(0); - let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => 0; [colors2]); + let row3 = test_row!(entity_path @ [build_frame_nr(frame3)] => [colors2]); let points4 = build_some_positions2d(0); - let row4 = test_row!(entity_path @ [build_frame_nr(frame4)] => 0; [points4]); + let row4 = test_row!(entity_path @ [build_frame_nr(frame4)] => [points4]); // Insert the 3 rows as static let mut static_table = diff --git a/crates/re_data_store/tests/dump.rs b/crates/re_data_store/tests/dump.rs index e3e0b6c5063f9..00f1824f4f468 100644 --- a/crates/re_data_store/tests/dump.rs +++ b/crates/re_data_store/tests/dump.rs @@ -7,11 +7,10 @@ use re_data_store::{ DataStore, DataStoreStats, GarbageCollectionOptions, TimeInt, TimeRange, Timeline, }; use re_log_types::{ - build_frame_nr, build_log_time, DataRow, DataTable, EntityPath, RowId, TableId, + build_frame_nr, build_log_time, example_components::MyIndex, DataRow, DataTable, EntityPath, + RowId, TableId, }; -use re_types::components::InstanceKey; -use re_types::datagen::{build_some_colors, build_some_instances, build_some_positions2d}; -use re_types_core::Loggable as _; +use re_types::datagen::{build_some_colors, build_some_positions2d}; // --- @@ -47,7 +46,6 @@ impl RowSet { std::collections::hash_map::Entry::Occupied(mut entry) => { assert_eq!(entry.get().entity_path(), row.entity_path()); assert_eq!(entry.get().cells(), row.cells()); - assert_eq!(entry.get().num_instances(), row.num_instances()); for (timeline, time) in row.timepoint() { entry.get_mut().timepoint.insert(*timeline, *time); } @@ -79,17 +77,14 @@ fn data_store_dump() { let mut store1 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); let mut store2 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); let mut store3 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); @@ -184,12 +179,10 @@ fn data_store_dump_filtered() { let mut store1 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); let mut store2 = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config.clone(), ); @@ -281,25 +274,25 @@ fn create_insert_table(entity_path: impl Into) -> DataTable { let frame3 = TimeInt::new_temporal(3); let frame4 = TimeInt::new_temporal(4); - let (instances1, colors1) = (build_some_instances(3), build_some_colors(3)); + let (instances1, colors1) = (MyIndex::from_iter(0..3), build_some_colors(3)); let row1 = test_row!(entity_path @ [ build_frame_nr(frame1), - ] => 3; [instances1.clone(), colors1]); + ] => [instances1.clone(), colors1]); let positions2 = build_some_positions2d(3); let row2 = test_row!(entity_path @ [ build_frame_nr(frame2), - ] => 3; [instances1, positions2]); + ] => [instances1, positions2]); let positions3 = build_some_positions2d(10); let row3 = test_row!(entity_path @ [ build_log_time(frame3.into()) /* ! */, build_frame_nr(frame3), - ] => 10; [positions3]); + ] => [positions3]); let colors4 = build_some_colors(5); let row4 = test_row!(entity_path @ [ build_frame_nr(frame4), - ] => 5; [colors4]); + ] => [colors4]); let mut table = DataTable::from_rows(TableId::new(), [row1, row2, row3, row4]); table.compute_all_size_bytes(); @@ -321,7 +314,6 @@ fn data_store_dump_empty_column() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), config, ); @@ -336,15 +328,15 @@ fn data_store_dump_empty_column_impl(store: &mut DataStore) { // Start by inserting a table with 2 rows, one with colors, and one with points. { - let (instances1, colors1) = (build_some_instances(3), build_some_colors(3)); + let (instances1, colors1) = (MyIndex::from_iter(0..3), build_some_colors(3)); let row1 = test_row!(entity_path @ [ build_frame_nr(frame1), - ] => 3; [instances1, colors1]); + ] => [instances1, colors1]); - let (instances2, positions2) = (build_some_instances(3), build_some_positions2d(3)); + let (instances2, positions2) = (MyIndex::from_iter(0..3), build_some_positions2d(3)); let row2 = test_row!(entity_path @ [ build_frame_nr(frame2), - ] => 3; [instances2, positions2]); + ] => [instances2, positions2]); let mut table = DataTable::from_rows(TableId::new(), [row1, row2]); table.compute_all_size_bytes(); insert_table_with_retries(store, &table); @@ -352,10 +344,10 @@ fn data_store_dump_empty_column_impl(store: &mut DataStore) { // Now insert another table with points only. { - let (instances3, positions3) = (build_some_instances(3), build_some_colors(3)); + let (instances3, positions3) = (MyIndex::from_iter(0..3), build_some_colors(3)); let row3 = test_row!(entity_path @ [ build_frame_nr(frame3), - ] => 3; [instances3, positions3]); + ] => [instances3, positions3]); let mut table = DataTable::from_rows(TableId::new(), [row3]); table.compute_all_size_bytes(); insert_table_with_retries(store, &table); diff --git a/crates/re_data_store/tests/internals.rs b/crates/re_data_store/tests/internals.rs index 5449c284626fc..b0cb6b5e351c5 100644 --- a/crates/re_data_store/tests/internals.rs +++ b/crates/re_data_store/tests/internals.rs @@ -3,9 +3,9 @@ //! They're awful, but sometimes you just have to… use re_data_store::{DataStore, DataStoreConfig}; -use re_log_types::{build_frame_nr, DataRow, EntityPath, RowId, TimePoint}; -use re_types::{components::InstanceKey, datagen::build_some_instances}; -use re_types_core::Loggable as _; +use re_log_types::{ + build_frame_nr, example_components::MyIndex, DataRow, EntityPath, RowId, TimePoint, +}; // --- Internals --- @@ -24,7 +24,6 @@ fn pathological_bucket_topology() { let mut store_forward = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig { indexed_bucket_num_rows: 10, ..Default::default() @@ -32,7 +31,6 @@ fn pathological_bucket_topology() { ); let mut store_backward = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig { indexed_bucket_num_rows: 10, ..Default::default() @@ -54,8 +52,7 @@ fn pathological_bucket_topology() { RowId::new(), entity_path.clone(), timepoint.clone(), - num_instances, - build_some_instances(num_instances as _), + MyIndex::from_iter(0..num_instances), ) .unwrap(); store_forward.insert_row(&row).unwrap(); @@ -64,8 +61,7 @@ fn pathological_bucket_topology() { RowId::new(), entity_path.clone(), timepoint.clone(), - num_instances, - build_some_instances(num_instances as _), + MyIndex::from_iter(0..num_instances), ) .unwrap(); store_backward.insert_row(&row).unwrap(); @@ -87,8 +83,7 @@ fn pathological_bucket_topology() { RowId::new(), entity_path.clone(), timepoint, - num_instances, - build_some_instances(num_instances as _), + MyIndex::from_iter(0..num_instances), ) .unwrap() }) diff --git a/crates/re_data_store/tests/memory_test.rs b/crates/re_data_store/tests/memory_test.rs index 2b9b1f5c409f4..42c34c088a17f 100644 --- a/crates/re_data_store/tests/memory_test.rs +++ b/crates/re_data_store/tests/memory_test.rs @@ -57,8 +57,7 @@ fn memory_use(run: impl Fn() -> R) -> usize { use re_data_store::{DataStore, DataStoreConfig}; use re_log_types::{DataRow, RowId, TimePoint, TimeType, Timeline}; -use re_types::components::{InstanceKey, Scalar}; -use re_types_core::Loggable as _; +use re_types::components::Scalar; /// The memory overhead of storing many scalars in the store. #[test] @@ -70,7 +69,6 @@ fn scalar_memory_overhead() { let total_mem_use = memory_use(|| { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), DataStoreConfig::default(), ); @@ -78,12 +76,10 @@ fn scalar_memory_overhead() { let entity_path = re_log_types::entity_path!("scalar"); let timepoint = TimePoint::default().with(Timeline::new("log_time", TimeType::Time), i as i64); - let num_instances = 1; let row = DataRow::from_cells1_sized( RowId::new(), entity_path, timepoint, - num_instances, vec![Scalar(i as f64)], ) .unwrap(); diff --git a/crates/re_data_ui/src/component.rs b/crates/re_data_ui/src/component.rs index d8674cc0e130b..9dafb7f4bb4f9 100644 --- a/crates/re_data_ui/src/component.rs +++ b/crates/re_data_ui/src/component.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use egui::NumExt; use re_entity_db::{external::re_query::LatestAtComponentResults, EntityPath, InstancePath}; +use re_log_types::Instance; use re_types::ComponentName; use re_ui::SyntaxHighlighting as _; use re_viewer_context::{UiVerbosity, ViewerContext}; @@ -85,7 +86,7 @@ impl DataUi for EntityLatestAtResults { db, &self.entity_path, &self.results, - &re_types::components::InstanceKey(0), + &Instance::from(0), ); } else if one_line { ui.label(format!("{} values", re_format::format_uint(num_instances))); @@ -108,10 +109,10 @@ impl DataUi for EntityLatestAtResults { re_ui::ReUi::setup_table_body(&mut body); let row_height = re_ui::ReUi::table_line_height(); body.rows(row_height, num_displayed_rows, |mut row| { - let instance_key = re_types::components::InstanceKey(row.index() as _); + let instance = Instance::from(row.index() as u64); row.col(|ui| { let instance_path = - InstancePath::instance(self.entity_path.clone(), instance_key); + InstancePath::instance(self.entity_path.clone(), instance); item_ui::instance_path_button_to( ctx, query, @@ -119,7 +120,7 @@ impl DataUi for EntityLatestAtResults { ui, None, &instance_path, - instance_key.syntax_highlighted(ui.style()), + instance.syntax_highlighted(ui.style()), ); }); row.col(|ui| { @@ -131,7 +132,7 @@ impl DataUi for EntityLatestAtResults { db, &self.entity_path, &self.results, - &instance_key, + &instance, ); }); }); diff --git a/crates/re_data_ui/src/component_ui_registry.rs b/crates/re_data_ui/src/component_ui_registry.rs index 19c92ed3c541e..066dd461c7c67 100644 --- a/crates/re_data_ui/src/component_ui_registry.rs +++ b/crates/re_data_ui/src/component_ui_registry.rs @@ -1,6 +1,6 @@ use re_data_store::LatestAtQuery; use re_entity_db::{external::re_query::LatestAtComponentResults, EntityDb}; -use re_log_types::{external::arrow2, EntityPath}; +use re_log_types::{external::arrow2, EntityPath, Instance}; use re_types::external::arrow2::array::Utf8Array; use re_viewer_context::{ComponentUiRegistry, UiVerbosity, ViewerContext}; @@ -44,7 +44,8 @@ pub fn add_to_registry(registry: &mut Com Box::new( |ctx, ui, verbosity, query, db, entity_path, component, instance| { // TODO(#5607): what should happen if the promise is still pending? - if let Some(component) = component.instance::(db.resolver(), instance.0 as _) { + if let Some(component) = component.instance::(db.resolver(), instance.get() as _) + { component.entity_data_ui(ctx, ui, verbosity, entity_path, query, db); } else { ui.weak("(not found)"); @@ -63,13 +64,13 @@ fn fallback_component_ui( db: &EntityDb, _entity_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { // TODO(#5607): what should happen if the promise is still pending? let value = component .component_name(db.resolver()) .and_then(|component_name| { - component.instance_raw(db.resolver(), component_name, instance_key.0 as _) + component.instance_raw(db.resolver(), component_name, instance.get() as _) }); // No special ui implementation - use a generic one: diff --git a/crates/re_data_ui/src/editors.rs b/crates/re_data_ui/src/editors.rs index b22499105bcef..e888ee92a59f6 100644 --- a/crates/re_data_ui/src/editors.rs +++ b/crates/re_data_ui/src/editors.rs @@ -3,7 +3,7 @@ use egui::NumExt as _; use re_data_store::LatestAtQuery; use re_entity_db::{external::re_query::LatestAtComponentResults, EntityDb}; -use re_log_types::EntityPath; +use re_log_types::{EntityPath, Instance}; use re_types::{ components::{ Color, MarkerShape, MarkerSize, Name, Radius, ScalarScattering, StrokeWidth, Text, @@ -24,11 +24,11 @@ fn edit_color_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_color = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_color(ctx, query, db, entity_path)); let current_color = current_color.into(); @@ -67,11 +67,11 @@ fn edit_text_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_text = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_text(ctx, query, db, entity_path)); let current_text = current_text.to_string(); @@ -107,11 +107,11 @@ fn edit_name_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_text = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_name(ctx, query, db, entity_path)); let current_text = current_text.to_string(); @@ -148,11 +148,11 @@ fn edit_scatter_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_scatter = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_scatter(ctx, query, db, entity_path)); let current_scatter = current_scatter.0; @@ -197,11 +197,11 @@ fn edit_radius_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_radius = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_radius(ctx, query, db, entity_path)); let current_radius = current_radius.0; @@ -244,11 +244,11 @@ fn edit_marker_shape_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_marker = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_marker_shape(ctx, query, db, entity_path)); let mut edit_marker = current_marker; @@ -330,11 +330,11 @@ fn edit_stroke_width_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_stroke_width = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_stroke_width(ctx, query, db, entity_path)); let current_stroke_width = current_stroke_width.0; @@ -377,11 +377,11 @@ fn edit_marker_size_ui( entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &re_types::components::InstanceKey, + instance: &Instance, ) { let current_marker_size = component // TODO(#5607): what should happen if the promise is still pending? - .instance::(db.resolver(), instance_key.0 as _) + .instance::(db.resolver(), instance.get() as _) .unwrap_or_else(|| default_marker_size(ctx, query, db, entity_path)); let current_marker_size = current_marker_size.0; @@ -426,7 +426,7 @@ fn register_editor<'a, C: Component + Loggable + 'static>( &EntityPath, &EntityPath, &LatestAtComponentResults, - &re_types::components::InstanceKey, + &Instance, ), ) where C: Into<::std::borrow::Cow<'a, C>>, diff --git a/crates/re_data_ui/src/entity_path.rs b/crates/re_data_ui/src/entity_path.rs index 6348b21ddbac2..e010d7fb58606 100644 --- a/crates/re_data_ui/src/entity_path.rs +++ b/crates/re_data_ui/src/entity_path.rs @@ -12,6 +12,6 @@ impl DataUi for re_entity_db::EntityPath { query: &re_data_store::LatestAtQuery, db: &re_entity_db::EntityDb, ) { - InstancePath::entity_splat(self.clone()).data_ui(ctx, ui, verbosity, query, db); + InstancePath::entity_all(self.clone()).data_ui(ctx, ui, verbosity, query, db); } } diff --git a/crates/re_data_ui/src/instance_path.rs b/crates/re_data_ui/src/instance_path.rs index 2f180a645faa9..7a31e1bc46128 100644 --- a/crates/re_data_ui/src/instance_path.rs +++ b/crates/re_data_ui/src/instance_path.rs @@ -18,7 +18,7 @@ impl DataUi for InstancePath { ) { let Self { entity_path, - instance_key, + instance, } = self; let Some(components) = ctx @@ -91,7 +91,7 @@ impl DataUi for InstancePath { &ComponentPath::new(entity_path.clone(), component_name), ); - if instance_key.is_splat() { + if instance.is_all() { crate::EntityLatestAtResults { entity_path: entity_path.clone(), component_name, @@ -107,7 +107,7 @@ impl DataUi for InstancePath { db, entity_path, results, - instance_key, + instance, ); } diff --git a/crates/re_data_ui/src/item_ui.rs b/crates/re_data_ui/src/item_ui.rs index 001c3320297dd..c6683b988cc04 100644 --- a/crates/re_data_ui/src/item_ui.rs +++ b/crates/re_data_ui/src/item_ui.rs @@ -47,7 +47,7 @@ pub fn entity_path_button( db, ui, space_view_id, - &InstancePath::entity_splat(entity_path.clone()), + &InstancePath::entity_all(entity_path.clone()), entity_path.syntax_highlighted(ui.style()), ) } @@ -67,7 +67,7 @@ pub fn entity_path_parts_buttons( ui.spacing_mut().item_spacing.x = 2.0; // Show one single icon up-front instead: - let instance_path = InstancePath::entity_splat(entity_path.clone()); + let instance_path = InstancePath::entity_all(entity_path.clone()); ui.add(instance_path_icon(&query.timeline(), db, &instance_path).as_image()); let mut accumulated = Vec::new(); @@ -81,7 +81,7 @@ pub fn entity_path_parts_buttons( db, ui, space_view_id, - &InstancePath::entity_splat(accumulated.clone().into()), + &InstancePath::entity_all(accumulated.clone().into()), part.syntax_highlighted(ui.style()), with_icon, ); @@ -106,7 +106,7 @@ pub fn entity_path_button_to( db, ui, space_view_id, - &InstancePath::entity_splat(entity_path.clone()), + &InstancePath::entity_all(entity_path.clone()), text, ) } @@ -140,7 +140,7 @@ pub fn instance_path_icon( db: &re_entity_db::EntityDb, instance_path: &InstancePath, ) -> &'static icons::Icon { - if instance_path.is_splat() { + if instance_path.is_all() { // It is an entity path if db .store() @@ -268,13 +268,13 @@ pub fn instance_path_parts_buttons( db, ui, space_view_id, - &InstancePath::entity_splat(accumulated.clone().into()), + &InstancePath::entity_all(accumulated.clone().into()), part.syntax_highlighted(ui.style()), with_icon, ); } - if !instance_path.instance_key.is_splat() { + if !instance_path.instance.is_all() { ui.weak("["); instance_path_button_to_ex( ctx, @@ -283,7 +283,7 @@ pub fn instance_path_parts_buttons( ui, space_view_id, instance_path, - instance_path.instance_key.syntax_highlighted(ui.style()), + instance_path.instance.syntax_highlighted(ui.style()), with_icon, ); ui.weak("]"); @@ -411,10 +411,7 @@ pub fn data_blueprint_button_to( space_view_id: SpaceViewId, entity_path: &EntityPath, ) -> egui::Response { - let item = Item::DataResult( - space_view_id, - InstancePath::entity_splat(entity_path.clone()), - ); + let item = Item::DataResult(space_view_id, InstancePath::entity_all(entity_path.clone())); let response = ui .selectable_label(ctx.selection().contains_item(&item), text) .on_hover_ui(|ui| { @@ -497,7 +494,8 @@ pub fn cursor_interact_with_selectable( /// Displays the "hover card" (i.e. big tooltip) for an instance or an entity. /// -/// The entity hover card is displayed the provided instance path is a splat. +/// The entity hover card is displayed if the provided instance path doesn't refer to a specific +/// instance. pub fn instance_hover_card_ui( ui: &mut egui::Ui, ctx: &ViewerContext<'_>, @@ -510,7 +508,7 @@ pub fn instance_hover_card_ui( return; } - let subtype_string = if instance_path.instance_key.is_splat() { + let subtype_string = if instance_path.instance.is_all() { "Entity" } else { "Entity instance" @@ -521,7 +519,7 @@ pub fn instance_hover_card_ui( // TODO(emilk): give data_ui an alternate "everything on this timeline" query? // Then we can move the size view into `data_ui`. - if instance_path.instance_key.is_splat() { + if instance_path.instance.is_all() { if let Some(subtree) = ctx.recording().tree().subtree(&instance_path.entity_path) { entity_tree_stats_ui(ui, &query.timeline(), subtree); } @@ -540,7 +538,7 @@ pub fn entity_hover_card_ui( db: &re_entity_db::EntityDb, entity_path: &EntityPath, ) { - let instance_path = InstancePath::entity_splat(entity_path.clone()); + let instance_path = InstancePath::entity_all(entity_path.clone()); instance_hover_card_ui(ui, ctx, query, db, &instance_path); } diff --git a/crates/re_data_ui/src/lib.rs b/crates/re_data_ui/src/lib.rs index 698db4a171f98..6e6b696d4e366 100644 --- a/crates/re_data_ui/src/lib.rs +++ b/crates/re_data_ui/src/lib.rs @@ -59,7 +59,7 @@ pub fn ui_visible_components<'a>( /// Show this component in the UI. pub fn is_component_visible_in_ui(component_name: &ComponentName) -> bool { - const HIDDEN_COMPONENTS: &[&str] = &["rerun.components.InstanceKey"]; + const HIDDEN_COMPONENTS: &[&str] = &[]; !HIDDEN_COMPONENTS.contains(&component_name.as_ref()) } diff --git a/crates/re_entity_db/examples/memory_usage.rs b/crates/re_entity_db/examples/memory_usage.rs index 608ec9d3b0b25..f8431a681d891 100644 --- a/crates/re_entity_db/examples/memory_usage.rs +++ b/crates/re_entity_db/examples/memory_usage.rs @@ -112,7 +112,6 @@ fn log_messages() { RowId::new(), entity_path!("points"), [build_frame_nr(TimeInt::ZERO)], - 1, build_some_positions2d(1), ) .unwrap() @@ -139,7 +138,6 @@ fn log_messages() { RowId::new(), entity_path!("points"), [build_frame_nr(TimeInt::ZERO)], - NUM_POINTS as _, build_some_positions2d(NUM_POINTS), ) .unwrap() diff --git a/crates/re_entity_db/src/entity_db.rs b/crates/re_entity_db/src/entity_db.rs index 4b7f52532921d..f37daead498bc 100644 --- a/crates/re_entity_db/src/entity_db.rs +++ b/crates/re_entity_db/src/entity_db.rs @@ -13,7 +13,7 @@ use re_log_types::{ Timeline, }; use re_query::PromiseResult; -use re_types_core::{components::InstanceKey, Archetype, Loggable}; +use re_types_core::{Archetype, Loggable}; use crate::{ClearCascade, CompactedStoreEvents, Error, TimesPerTimeline}; @@ -127,11 +127,8 @@ pub struct EntityDb { impl EntityDb { pub fn new(store_id: StoreId) -> Self { - let data_store = re_data_store::DataStore::new( - store_id.clone(), - InstanceKey::name(), - DataStoreConfig::default(), - ); + let data_store = + re_data_store::DataStore::new(store_id.clone(), DataStoreConfig::default()); let query_caches = re_query::Caches::new(&data_store); Self { data_source: None, @@ -518,7 +515,7 @@ impl EntityDb { // 2. Otherwise we will end up with a flaky row ordering, as we have no way to tie-break // these rows! This flaky ordering will in turn leak through the public // API (e.g. range queries)! - match DataRow::from_cells(row_id, timepoint.clone(), entity_path, 0, cells) { + match DataRow::from_cells(row_id, timepoint.clone(), entity_path, cells) { Ok(row) => { let res = insert_row_with_retries( &mut self.data_store, diff --git a/crates/re_entity_db/src/instance_path.rs b/crates/re_entity_db/src/instance_path.rs index d0d2817c10d58..ffd05a7986fac 100644 --- a/crates/re_entity_db/src/instance_path.rs +++ b/crates/re_entity_db/src/instance_path.rs @@ -1,13 +1,12 @@ use std::{hash::Hash, str::FromStr}; -use re_log_types::{DataPath, EntityPath, EntityPathHash, PathParseError, RowId}; -use re_types_core::components::InstanceKey; +use re_log_types::{DataPath, EntityPath, EntityPathHash, Instance, PathParseError, RowId}; use crate::{EntityDb, VersionedInstancePath, VersionedInstancePathHash}; // ---------------------------------------------------------------------------- -/// The path to either a specific instance of an entity, or the whole entity (splat). +/// The path to either a specific instance of an entity, or the whole entity. #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct InstancePath { @@ -15,36 +14,36 @@ pub struct InstancePath { /// If this is a concrete instance, what instance index are we? /// - /// If we refer to all instance, [`InstanceKey::SPLAT`] is used. - pub instance_key: InstanceKey, + /// If we refer to all instances, [`Instance::ALL`] is used. + pub instance: Instance, } impl From for InstancePath { #[inline] fn from(entity_path: EntityPath) -> Self { - Self::entity_splat(entity_path) + Self::entity_all(entity_path) } } impl InstancePath { - /// Indicate the whole entity (all instances of it) - i.e. a splat. + /// Indicate the whole entity (all instances of it). /// /// For example: the whole point cloud, rather than a specific point. #[inline] - pub fn entity_splat(entity_path: EntityPath) -> Self { + pub fn entity_all(entity_path: EntityPath) -> Self { Self { entity_path, - instance_key: InstanceKey::SPLAT, + instance: Instance::ALL, } } /// Indicate a specific instance of the entity, /// e.g. a specific point in a point cloud entity. #[inline] - pub fn instance(entity_path: EntityPath, instance_key: InstanceKey) -> Self { + pub fn instance(entity_path: EntityPath, instance: Instance) -> Self { Self { entity_path, - instance_key, + instance, } } @@ -52,8 +51,8 @@ impl InstancePath { /// /// For example: the whole point cloud, rather than a specific point. #[inline] - pub fn is_splat(&self) -> bool { - self.instance_key.is_splat() + pub fn is_all(&self) -> bool { + self.instance.is_all() } /// Versions this instance path by stamping it with the specified [`RowId`]. @@ -69,17 +68,17 @@ impl InstancePath { pub fn hash(&self) -> InstancePathHash { InstancePathHash { entity_path_hash: self.entity_path.hash(), - instance_key: self.instance_key, + instance: self.instance, } } } impl std::fmt::Display for InstancePath { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - if self.instance_key.is_splat() { + if self.instance.is_all() { self.entity_path.fmt(f) } else { - format!("{}[{}]", self.entity_path, self.instance_key).fmt(f) + format!("{}[{}]", self.entity_path, self.instance).fmt(f) } } } @@ -90,7 +89,7 @@ impl FromStr for InstancePath { fn from_str(s: &str) -> Result { let DataPath { entity_path, - instance_key, + instance, component_name, } = DataPath::from_str(s)?; @@ -98,11 +97,11 @@ impl FromStr for InstancePath { return Err(PathParseError::UnexpectedComponentName(component_name)); } - let instance_key = instance_key.unwrap_or(InstanceKey::SPLAT); + let instance = instance.unwrap_or(Instance::ALL); Ok(InstancePath { entity_path, - instance_key, + instance, }) } } @@ -113,7 +112,7 @@ fn test_parse_instance_path() { InstancePath::from_str("world/points[#123]"), Ok(InstancePath { entity_path: EntityPath::from("world/points"), - instance_key: InstanceKey(123) + instance: Instance::from(123) }) ); } @@ -122,30 +121,30 @@ fn test_parse_instance_path() { /// Hashes of the components of an [`InstancePath`]. /// -/// This is unique to either a specific instance of an entity, or the whole entity (splat). +/// This is unique to either a specific instance of an entity, or the whole entity. #[derive(Clone, Copy, Eq)] pub struct InstancePathHash { pub entity_path_hash: EntityPathHash, /// If this is a concrete instance, what instance index are we? /// - /// If we refer to all instance, [`InstanceKey::SPLAT`] is used. + /// If we refer to all instance, [`Instance::ALL`] is used. /// /// Note that this is NOT hashed, because we don't need to (it's already small). - pub instance_key: InstanceKey, + pub instance: Instance, } impl std::fmt::Debug for InstancePathHash { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let Self { entity_path_hash, - instance_key, + instance, } = self; write!( f, "InstancePathHash({:016X}, {})", entity_path_hash.hash64(), - instance_key.0 + instance.get() ) } } @@ -155,11 +154,11 @@ impl std::hash::Hash for InstancePathHash { fn hash(&self, state: &mut H) { let Self { entity_path_hash, - instance_key, + instance, } = self; state.write_u64(entity_path_hash.hash64()); - state.write_u64(instance_key.0); + state.write_u64(instance.get()); } } @@ -168,37 +167,37 @@ impl std::cmp::PartialEq for InstancePathHash { fn eq(&self, other: &Self) -> bool { let Self { entity_path_hash, - instance_key, + instance, } = self; - entity_path_hash == &other.entity_path_hash && instance_key == &other.instance_key + entity_path_hash == &other.entity_path_hash && instance == &other.instance } } impl InstancePathHash { pub const NONE: Self = Self { entity_path_hash: EntityPathHash::NONE, - instance_key: InstanceKey::SPLAT, + instance: Instance::ALL, }; - /// Indicate the whole entity (all instances of it) - i.e. a splat. + /// Indicate the whole entity (all instances of it). /// /// For example: the whole point cloud, rather than a specific point. #[inline] - pub fn entity_splat(entity_path: &EntityPath) -> Self { + pub fn entity_all(entity_path: &EntityPath) -> Self { Self { entity_path_hash: entity_path.hash(), - instance_key: InstanceKey::SPLAT, + instance: Instance::ALL, } } /// Indicate a specific instance of the entity, /// e.g. a specific point in a point cloud entity. #[inline] - pub fn instance(entity_path: &EntityPath, instance_key: InstanceKey) -> Self { + pub fn instance(entity_path: &EntityPath, instance: Instance) -> Self { Self { entity_path_hash: entity_path.hash(), - instance_key, + instance, } } @@ -226,11 +225,11 @@ impl InstancePathHash { .entity_path_from_hash(&self.entity_path_hash) .cloned()?; - let instance_key = self.instance_key; + let instance = self.instance; Some(InstancePath { entity_path, - instance_key, + instance, }) } } diff --git a/crates/re_entity_db/src/versioned_instance_path.rs b/crates/re_entity_db/src/versioned_instance_path.rs index eedc219b2b2db..e7dc24e4a0a82 100644 --- a/crates/re_entity_db/src/versioned_instance_path.rs +++ b/crates/re_entity_db/src/versioned_instance_path.rs @@ -7,7 +7,7 @@ use crate::{InstancePath, InstancePathHash}; // ---------------------------------------------------------------------------- /// A versioned path (i.e. pinned to a specific [`RowId`]) to either a specific instance of an entity, -/// or the whole entity (splat). +/// or the whole entity. /// /// The easiest way to construct this type is via [`crate::InstancePath::versioned`]. #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] @@ -22,8 +22,8 @@ impl VersionedInstancePath { /// /// For example: the whole point cloud, rather than a specific point. #[inline] - pub fn is_splat(&self) -> bool { - self.instance_path.is_splat() + pub fn is_all(&self) -> bool { + self.instance_path.is_all() } #[inline] @@ -75,11 +75,11 @@ impl std::hash::Hash for VersionedInstancePathHash { } = self; let InstancePathHash { entity_path_hash, - instance_key, + instance, } = instance_path_hash; state.write_u64(entity_path_hash.hash64()); - state.write_u64(instance_key.0); + state.write_u64(instance.get()); state.write_u128(row_id.as_u128()); } } diff --git a/crates/re_entity_db/tests/clear.rs b/crates/re_entity_db/tests/clear.rs index 3172536078d41..fb201eb3fd3e4 100644 --- a/crates/re_entity_db/tests/clear.rs +++ b/crates/re_entity_db/tests/clear.rs @@ -1,14 +1,10 @@ use re_data_store::{DataStore, LatestAtQuery}; use re_entity_db::EntityDb; use re_log_types::{ - example_components::{MyColor, MyPoint}, + example_components::{MyColor, MyIndex, MyPoint}, DataRow, EntityPath, RowId, StoreId, TimeInt, TimePoint, Timeline, }; -use re_types_core::{ - archetypes::Clear, - components::{ClearIsRecursive, InstanceKey}, - AsComponents, -}; +use re_types_core::{archetypes::Clear, components::ClearIsRecursive, AsComponents}; // --- @@ -222,28 +218,27 @@ fn clears() -> anyhow::Result<()> { { let row_id = RowId::new(); let timepoint = TimePoint::from_iter([(timeline_frame, 9)]); - let instance_key = InstanceKey(0); + let instance = MyIndex(0); let row = DataRow::from_component_batches( row_id, timepoint, entity_path_parent.clone(), - [&[instance_key] as _], + [&[instance] as _], )?; db.add_data_row(row)?; { let query = LatestAtQuery::new(timeline_frame, 9); - let (_, _, got_instance_key) = - query_latest_component::(db.store(), &entity_path_parent, &query) - .unwrap(); - similar_asserts::assert_eq!(instance_key, got_instance_key); + let (_, _, got_instance) = + query_latest_component::(db.store(), &entity_path_parent, &query).unwrap(); + similar_asserts::assert_eq!(instance, got_instance); } { let query = LatestAtQuery::new(timeline_frame, 11); assert!( - query_latest_component::(db.store(), &entity_path_parent, &query) + query_latest_component::(db.store(), &entity_path_parent, &query) .is_none() ); } diff --git a/crates/re_entity_db/tests/time_histograms.rs b/crates/re_entity_db/tests/time_histograms.rs index e62aeaabc2fa8..e78efafa6f341 100644 --- a/crates/re_entity_db/tests/time_histograms.rs +++ b/crates/re_entity_db/tests/time_histograms.rs @@ -4,16 +4,10 @@ use re_data_store::GarbageCollectionOptions; use re_entity_db::EntityDb; use re_int_histogram::RangeI64; use re_log_types::{ - example_components::{MyColor, MyPoint}, + example_components::{MyColor, MyIndex, MyPoint}, DataRow, EntityPath, RowId, StoreId, TimeInt, TimePoint, Timeline, }; -use re_types_core::{ - components::{ClearIsRecursive, InstanceKey}, - ComponentName, Loggable, -}; - -// TODO(cmc): This should also test for the timeless counts but right now they're a bit all over -// the place, so need to land new reworked EntityTree etc first. +use re_types_core::{components::ClearIsRecursive, ComponentName, Loggable}; // --- @@ -31,7 +25,7 @@ fn time_histograms() -> anyhow::Result<()> { let entity_grandchild: EntityPath = "parent/child/grandchild".into(); let entity_unrelated: EntityPath = "very/unrelated".into(); - // Single top-level entity, explicitly logged `InstanceKey`s. + // Single top-level entity, explicitly logged `MyIndex`s. { let row = DataRow::from_component_batches( RowId::new(), @@ -41,7 +35,7 @@ fn time_histograms() -> anyhow::Result<()> { (timeline_yet_another, 1), // ]), entity_parent.clone(), - [&InstanceKey::from_iter(0..10) as _], + [&MyIndex::from_iter(0..10) as _], )?; db.add_data_row(row)?; @@ -72,7 +66,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_parent, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, Some(&[(RangeI64::new(42, 42), 1)])), (&timeline_other, Some(&[(RangeI64::new(666, 666), 1)])), @@ -81,7 +75,7 @@ fn time_histograms() -> anyhow::Result<()> { ); } - // Grand-child, multiple components, auto-generated `InstanceKey`s. + // Grand-child, multiple components, auto-generated `MyIndex`s. { let row = { let num_instances = 3; @@ -128,7 +122,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_parent, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, Some(&[(RangeI64::new(42, 42), 1)])), (&timeline_other, Some(&[(RangeI64::new(666, 666), 1)])), @@ -162,7 +156,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [(&timeline_frame, None), (&timeline_yet_another, None)] as [(_, Option<&[_]>); 2], ); assert_histogram_for_component( @@ -212,7 +206,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [(&timeline_frame, None), (&timeline_yet_another, None)] as [(_, Option<&[_]>); 2], ); assert_histogram_for_component( @@ -245,7 +239,7 @@ fn time_histograms() -> anyhow::Result<()> { TimePoint::default(), "entity".into(), [ - &InstanceKey::from_iter(0..num_instances as _) as _, + &MyIndex::from_iter(0..num_instances as _) as _, &colors as _, ], )? @@ -299,7 +293,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [(&timeline_frame, None), (&timeline_yet_another, None)] as [(_, Option<&[_]>); 2], ); assert_histogram_for_component( @@ -339,7 +333,7 @@ fn time_histograms() -> anyhow::Result<()> { ]), entity_unrelated.clone(), [ - &InstanceKey::from_iter(0..num_instances) as _, + &MyIndex::from_iter(0..num_instances) as _, &points as _, &colors as _, ], @@ -382,7 +376,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_parent, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, Some(&[(RangeI64::new(42, 42), 1)])), (&timeline_other, Some(&[(RangeI64::new(666, 666), 1)])), @@ -415,7 +409,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_unrelated, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, Some(&[(RangeI64::new(1234, 1234), 1)])), (&timeline_other, Some(&[(RangeI64::new(1235, 1235), 1)])), @@ -487,8 +481,8 @@ fn time_histograms() -> anyhow::Result<()> { &timeline_frame, Some(&[ (RangeI64::new(42, 42), 5), - // We're clearing the parent's `InstanceKey` as well as the grandchild's - // `MyPoint`, `MyColor` and `InstanceKey`. That's four. + // We're clearing the parent's `MyIndex` as well as the grandchild's + // `MyPoint`, `MyColor` and `MyIndex`. That's four. (RangeI64::new(1000, 1000), 4), (RangeI64::new(1234, 1234), 3), ]), @@ -508,7 +502,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_parent, - InstanceKey::name(), + MyIndex::name(), [ ( &timeline_frame, @@ -523,7 +517,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, None), (&timeline_other, None), @@ -533,7 +527,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [(&timeline_frame, None), (&timeline_yet_another, None)] as [(_, Option<&[_]>); 2], ); // NOTE: even though the component was logged twice at the same timestamp, the clear will @@ -593,7 +587,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_parent, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, Some(&[])), (&timeline_other, Some(&[])), @@ -605,7 +599,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [ (&timeline_frame, None), (&timeline_other, None), @@ -615,7 +609,7 @@ fn time_histograms() -> anyhow::Result<()> { assert_histogram_for_component( &db, &entity_grandchild, - InstanceKey::name(), + MyIndex::name(), [(&timeline_frame, None), (&timeline_yet_another, None)] as [(_, Option<&[_]>); 2], ); assert_histogram_for_component( diff --git a/crates/re_log_encoding/benches/msg_encode_benchmark.rs b/crates/re_log_encoding/benches/msg_encode_benchmark.rs index df825fffe618c..c02bc4cec8e56 100644 --- a/crates/re_log_encoding/benches/msg_encode_benchmark.rs +++ b/crates/re_log_encoding/benches/msg_encode_benchmark.rs @@ -75,7 +75,6 @@ fn mono_points_arrow(c: &mut Criterion) { RowId::ZERO, entity_path!("points", i.to_string()), [build_frame_nr(TimeInt::ZERO)], - 1, (build_some_positions2d(1), build_some_colors(1)), ) .unwrap()], @@ -133,7 +132,6 @@ fn mono_points_arrow_batched(c: &mut Criterion) { RowId::ZERO, entity_path!("points", i.to_string()), [build_frame_nr(TimeInt::ZERO)], - 1, (build_some_positions2d(1), build_some_colors(1)), ) .unwrap() @@ -189,7 +187,6 @@ fn batch_points_arrow(c: &mut Criterion) { RowId::ZERO, entity_path!("points"), [build_frame_nr(TimeInt::ZERO)], - NUM_POINTS as _, ( build_some_positions2d(NUM_POINTS), build_some_colors(NUM_POINTS), diff --git a/crates/re_log_types/src/data_cell.rs b/crates/re_log_types/src/data_cell.rs index 7ab86bba9fcbe..9770e56343d9a 100644 --- a/crates/re_log_types/src/data_cell.rs +++ b/crates/re_log_types/src/data_cell.rs @@ -667,42 +667,3 @@ impl DataCellInner { + values.total_size_bytes(); } } - -#[test] -fn data_cell_sizes() { - use crate::DataCell; - use arrow2::array::UInt64Array; - use re_types_core::components::InstanceKey; - use re_types_core::Loggable as _; - - // not computed - // NOTE: Unsized cells are illegal in debug mode and will flat out crash. - if !cfg!(debug_assertions) { - let cell = DataCell::from_arrow(InstanceKey::name(), UInt64Array::from_vec(vec![]).boxed()); - assert_eq!(0, cell.heap_size_bytes()); - assert_eq!(0, cell.heap_size_bytes()); - } - - // zero-sized - { - let mut cell = - DataCell::from_arrow(InstanceKey::name(), UInt64Array::from_vec(vec![]).boxed()); - cell.compute_size_bytes(); - - assert_eq!(168, cell.heap_size_bytes()); - assert_eq!(168, cell.heap_size_bytes()); - } - - // anything else - { - let mut cell = DataCell::from_arrow( - InstanceKey::name(), - UInt64Array::from_vec(vec![1, 2, 3]).boxed(), - ); - cell.compute_size_bytes(); - - // zero-sized + 3x u64s - assert_eq!(192, cell.heap_size_bytes()); - assert_eq!(192, cell.heap_size_bytes()); - } -} diff --git a/crates/re_log_types/src/data_row.rs b/crates/re_log_types/src/data_row.rs index c1fdb9c8b72fd..d7711c2224252 100644 --- a/crates/re_log_types/src/data_row.rs +++ b/crates/re_log_types/src/data_row.rs @@ -4,7 +4,7 @@ use smallvec::SmallVec; use re_types_core::{AsComponents, ComponentName, SizeBytes}; -use crate::{DataCell, DataCellError, DataTable, EntityPath, NumInstances, TableId, TimePoint}; +use crate::{DataCell, DataCellError, DataTable, EntityPath, TableId, TimePoint}; // --- @@ -231,16 +231,15 @@ re_types_core::delegate_arrow_tuid!(RowId as "rerun.controls.RowId"); /// /// ## Layout /// -/// A row is a collection of cells where each cell must either be empty (a clear), unit-lengthed -/// (a splat) or `num_instances` long (standard): `[[C1, C1, C1], [], [C3], [C4, C4, C4], …]`. +/// A row is a collection of cells where each cell can have an arbitrary number of +/// instances: `[[C1, C1, C1], [], [C3], [C4, C4, C4], …]`. /// /// Consider this example: /// ```ignore -/// let num_instances = 2; /// let points: &[MyPoint] = &[[10.0, 10.0].into(), [20.0, 20.0].into()]; /// let colors: &[_] = &[MyColor::from_rgb(128, 128, 128)]; /// let labels: &[MyLabel] = &[]; -/// let row = DataRow::from_cells3(row_id, timepoint, ent_path, num_instances, (points, colors, labels)); +/// let row = DataRow::from_cells3(row_id, timepoint, ent_path, (points, colors, labels)); /// ``` /// /// A row has no arrow representation nor datatype of its own, as it is merely a collection of @@ -269,7 +268,6 @@ re_types_core::delegate_arrow_tuid!(RowId as "rerun.controls.RowId"); /// # (Timeline::new_sequence("clock"), 666), // /// # ]; /// # -/// let num_instances = 2; /// let points: &[MyPoint] = &[MyPoint { x: 10.0, y: 10.0}, MyPoint { x: 20.0, y: 20.0 }]; /// let colors: &[_] = &[MyColor(0xff7f7f7f)]; /// let labels: &[MyLabel] = &[]; @@ -278,7 +276,6 @@ re_types_core::delegate_arrow_tuid!(RowId as "rerun.controls.RowId"); /// row_id, /// "a/b/c", /// timepoint, -/// num_instances, /// (points, colors, labels), /// ).unwrap(); /// eprintln!("{row}"); @@ -297,14 +294,6 @@ pub struct DataRow { /// User-specified [`EntityPath`] for this event. pub entity_path: EntityPath, - /// The expected number of values (== component instances) in each cell. - /// - /// Each cell must have either: - /// - 0 instance (clear), - /// - 1 instance (splat), - /// - `num_instances` instances (standard). - pub num_instances: NumInstances, - /// The actual cells (== columns, == components). pub cells: DataCellRow, } @@ -342,26 +331,18 @@ impl DataRow { .map(DataCell::from_component_batch) .collect::, _>>()?; - // TODO(emilk): should `DataRow::from_cells` calculate `num_instances` instead? - let num_instances = data_cells.iter().map(|cell| cell.num_instances()).max(); - let num_instances = num_instances.unwrap_or(0); - - let mut row = - DataRow::from_cells(row_id, timepoint, entity_path, num_instances, data_cells)?; + let mut row = DataRow::from_cells(row_id, timepoint, entity_path, data_cells)?; row.compute_all_size_bytes(); Ok(row) } /// Builds a new `DataRow` from an iterable of [`DataCell`]s. /// - /// Fails if: - /// - one or more cell isn't 0, 1 or `num_instances` long, - /// - two or more cells share the same component type. + /// Fails if two or more cells share the same component type. pub fn from_cells( row_id: RowId, timepoint: impl Into, entity_path: impl Into, - num_instances: u32, cells: impl IntoIterator, ) -> DataReadResult { let cells = DataCellRow(cells.into_iter().collect()); @@ -385,7 +366,6 @@ impl DataRow { row_id, entity_path, timepoint, - num_instances: num_instances.into(), cells, }) } @@ -412,14 +392,12 @@ impl SizeBytes for DataRow { row_id, timepoint, entity_path, - num_instances, cells, } = self; row_id.heap_size_bytes() + timepoint.heap_size_bytes() + entity_path.heap_size_bytes() - + num_instances.heap_size_bytes() + cells.heap_size_bytes() } } @@ -450,11 +428,6 @@ impl DataRow { self.cells.iter().map(|cell| cell.component_name()) } - #[inline] - pub fn num_instances(&self) -> NumInstances { - self.num_instances - } - #[inline] pub fn cells(&self) -> &DataCellRow { &self.cells @@ -501,7 +474,6 @@ impl DataRow { row_id: RowId, entity_path: impl Into, timepoint: impl Into, - num_instances: u32, into_cells: C0, ) -> DataReadResult where @@ -511,7 +483,6 @@ impl DataRow { row_id, timepoint.into(), entity_path.into(), - num_instances, [into_cells.into()], )?; this.compute_all_size_bytes(); @@ -522,7 +493,6 @@ impl DataRow { row_id: RowId, entity_path: impl Into, timepoint: impl Into, - num_instances: u32, into_cells: C0, ) -> DataRowResult where @@ -533,7 +503,6 @@ impl DataRow { row_id, timepoint.into(), entity_path.into(), - num_instances, [into_cells.try_into()?], )?) } @@ -547,7 +516,6 @@ impl DataRow { row_id: RowId, entity_path: impl Into, timepoint: impl Into, - num_instances: u32, into_cells: (C0, C1), ) -> DataRowResult where @@ -558,7 +526,6 @@ impl DataRow { row_id, timepoint.into(), entity_path.into(), - num_instances, [ into_cells.0.into(), // into_cells.1.into(), // @@ -572,7 +539,6 @@ impl DataRow { row_id: RowId, entity_path: impl Into, timepoint: impl Into, - num_instances: u32, into_cells: (C0, C1), ) -> DataRowResult where @@ -585,7 +551,6 @@ impl DataRow { row_id, timepoint.into(), entity_path.into(), - num_instances, [ into_cells.0.try_into()?, // into_cells.1.try_into()?, // @@ -597,7 +562,6 @@ impl DataRow { row_id: RowId, entity_path: impl Into, timepoint: impl Into, - num_instances: u32, into_cells: (C0, C1, C2), ) -> DataRowResult where @@ -612,7 +576,6 @@ impl DataRow { row_id, timepoint.into(), entity_path.into(), - num_instances, [ into_cells.0.try_into()?, // into_cells.1.try_into()?, // diff --git a/crates/re_log_types/src/data_table.rs b/crates/re_log_types/src/data_table.rs index a079064453b5e..fbe2f9ed2b514 100644 --- a/crates/re_log_types/src/data_table.rs +++ b/crates/re_log_types/src/data_table.rs @@ -11,7 +11,7 @@ use re_types_core::{ComponentName, Loggable, SizeBytes}; use crate::{ data_row::DataReadResult, ArrowMsg, DataCell, DataCellError, DataRow, DataRowError, EntityPath, - NumInstances, RowId, TimePoint, Timeline, + RowId, TimePoint, Timeline, }; // --- @@ -63,8 +63,6 @@ pub type ErasedTimeVec = VecDeque; pub type EntityPathVec = VecDeque; -pub type NumInstancesVec = VecDeque; - pub type DataCellOptVec = VecDeque>; /// A column's worth of [`DataCell`]s: a sparse collection of [`DataCell`]s that share the same @@ -229,8 +227,7 @@ re_types_core::delegate_arrow_tuid!(TableId as "rerun.controls.TableId"); /// ## Layout /// /// A table is a collection of sparse rows, which are themselves collections of cells, where each -/// cell must either be empty (a clear), unit-lengthed (a splat) or `num_instances` long -/// (standard): +/// cell can contain an arbitrary number of instances: /// ```text /// [ /// [[C1, C1, C1], [], [C3], [C4, C4, C4], …], @@ -243,22 +240,19 @@ re_types_core::delegate_arrow_tuid!(TableId as "rerun.controls.TableId"); /// Consider this example: /// ```ignore /// let row0 = { -/// let num_instances = 2; /// let points: &[MyPoint] = &[[10.0, 10.0].into(), [20.0, 20.0].into()]; /// let colors: &[_] = &[MyColor::from_rgb(128, 128, 128)]; /// let labels: &[Label] = &[]; -/// DataRow::from_cells3(RowId::new(), "a", timepoint(1, 1), num_instances, (points, colors, labels))? +/// DataRow::from_cells3(RowId::new(), "a", timepoint(1, 1), (points, colors, labels))? /// }; /// let row1 = { -/// let num_instances = 0; /// let colors: &[MyColor] = &[]; -/// DataRow::from_cells1(RowId::new(), "b", timepoint(1, 2), num_instances, colors)? +/// DataRow::from_cells1(RowId::new(), "b", timepoint(1, 2), colors)? /// }; /// let row2 = { -/// let num_instances = 1; /// let colors: &[_] = &[MyColor::from_rgb(255, 255, 255)]; /// let labels: &[_] = &[Label("hey".into())]; -/// DataRow::from_cells2(RowId::new(), "c", timepoint(2, 1), num_instances, (colors, labels))? +/// DataRow::from_cells2(RowId::new(), "c", timepoint(2, 1), (colors, labels))? /// }; /// let table = DataTable::from_rows(table_id, [row0, row1, row2]); /// ``` @@ -268,15 +262,15 @@ re_types_core::delegate_arrow_tuid!(TableId as "rerun.controls.TableId"); /// /// The table above translates to the following, where each column is contiguous in memory: /// ```text -/// ┌──────────┬───────────────────────────────┬──────────────────────────────────┬───────────────────┬─────────────────────┬─────────────┬──────────────────────────────────┬─────────────────┐ -/// │ frame_nr ┆ log_time ┆ rerun.row_id ┆ rerun.entity_path ┆ rerun.num_instances ┆ ┆ rerun.components.Point2D ┆ rerun.components.Color │ -/// ╞══════════╪═══════════════════════════════╪══════════════════════════════════╪═══════════════════╪═════════════════════╪═════════════╪══════════════════════════════════╪═════════════════╡ -/// │ 1 ┆ 2023-04-05 09:36:47.188796402 ┆ 1753004ACBF5D6E651F2983C3DAF260C ┆ a ┆ 2 ┆ [] ┆ [{x: 10, y: 10}, {x: 20, y: 20}] ┆ [2155905279] │ -/// ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ -/// │ 1 ┆ 2023-04-05 09:36:47.188852222 ┆ 1753004ACBF5D6E651F2983C3DAF260C ┆ b ┆ 0 ┆ - ┆ - ┆ [] │ -/// ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ -/// │ 2 ┆ 2023-04-05 09:36:47.188855872 ┆ 1753004ACBF5D6E651F2983C3DAF260C ┆ c ┆ 1 ┆ [hey] ┆ - ┆ [4294967295] │ -/// └──────────┴───────────────────────────────┴──────────────────────────────────┴───────────────────┴─────────────────────┴─────────────┴──────────────────────────────────┴─────────────────┘ +/// ┌──────────┬───────────────────────────────┬──────────────────────────────────┬───────────────────┬─────────────┬──────────────────────────────────┬─────────────────┐ +/// │ frame_nr ┆ log_time ┆ rerun.row_id ┆ rerun.entity_path ┆ ┆ rerun.components.Point2D ┆ rerun.components.Color │ +/// ╞══════════╪═══════════════════════════════╪══════════════════════════════════╪═══════════════════╪═════════════╪══════════════════════════════════╪═════════════════╡ +/// │ 1 ┆ 2023-04-05 09:36:47.188796402 ┆ 1753004ACBF5D6E651F2983C3DAF260C ┆ a ┆ [] ┆ [{x: 10, y: 10}, {x: 20, y: 20}] ┆ [2155905279] │ +/// ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ +/// │ 1 ┆ 2023-04-05 09:36:47.188852222 ┆ 1753004ACBF5D6E651F2983C3DAF260C ┆ b ┆ - ┆ - ┆ [] │ +/// ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ +/// │ 2 ┆ 2023-04-05 09:36:47.188855872 ┆ 1753004ACBF5D6E651F2983C3DAF260C ┆ c ┆ [hey] ┆ - ┆ [4294967295] │ +/// └──────────┴───────────────────────────────┴──────────────────────────────────┴───────────────────┴─────────────┴──────────────────────────────────┴─────────────────┘ /// ``` /// /// ## Example @@ -297,7 +291,6 @@ re_types_core::delegate_arrow_tuid!(TableId as "rerun.controls.TableId"); /// # }; /// # /// let row0 = { -/// let num_instances = 2; /// let points: &[MyPoint] = &[MyPoint { x: 10.0, y: 10.0 }, MyPoint { x: 20.0, y: 20.0 }]; /// let colors: &[_] = &[MyColor(0xff7f7f7f)]; /// let labels: &[MyLabel] = &[]; @@ -306,20 +299,17 @@ re_types_core::delegate_arrow_tuid!(TableId as "rerun.controls.TableId"); /// RowId::new(), /// "a", /// timepoint(1, 1), -/// num_instances, /// (points, colors, labels), /// ).unwrap() /// }; /// /// let row1 = { -/// let num_instances = 0; /// let colors: &[MyColor] = &[]; /// -/// DataRow::from_cells1(RowId::new(), "b", timepoint(1, 2), num_instances, colors).unwrap() +/// DataRow::from_cells1(RowId::new(), "b", timepoint(1, 2), colors).unwrap() /// }; /// /// let row2 = { -/// let num_instances = 1; /// let colors: &[_] = &[MyColor(0xff7f7f7f)]; /// let labels: &[_] = &[MyLabel("hey".into())]; /// @@ -327,7 +317,6 @@ re_types_core::delegate_arrow_tuid!(TableId as "rerun.controls.TableId"); /// RowId::new(), /// "c", /// timepoint(2, 1), -/// num_instances, /// (colors, labels), /// ).unwrap() /// }; @@ -368,11 +357,6 @@ pub struct DataTable { /// The entity each row relates to, respectively. pub col_entity_path: EntityPathVec, - /// The entire column of `num_instances`. - /// - /// Keeps track of the expected number of instances in each row. - pub col_num_instances: NumInstancesVec, - /// All the rows for all the component columns. /// /// The cells are optional since not all rows will have data for every single component @@ -388,7 +372,6 @@ impl DataTable { col_row_id: Default::default(), col_timelines: Default::default(), col_entity_path: Default::default(), - col_num_instances: Default::default(), columns: Default::default(), } } @@ -402,11 +385,10 @@ impl DataTable { // Explode all rows into columns, and keep track of which components are involved. let mut components = IntSet::default(); #[allow(clippy::type_complexity)] - let (col_row_id, col_timepoint, col_entity_path, col_num_instances, column): ( + let (col_row_id, col_timepoint, col_entity_path, column): ( RowIdVec, TimePointVec, EntityPathVec, - NumInstancesVec, Vec<_>, ) = rows .map(|row| { @@ -415,10 +397,9 @@ impl DataTable { row_id, timepoint, entity_path, - num_instances, cells, } = row; - (row_id, timepoint, entity_path, num_instances, cells) + (row_id, timepoint, entity_path, cells) }) .multiunzip(); @@ -467,7 +448,6 @@ impl DataTable { col_row_id, col_timelines, col_entity_path, - col_num_instances, columns, } } @@ -489,7 +469,6 @@ impl DataTable { col_row_id, col_timelines, col_entity_path, - col_num_instances, columns, } = self; @@ -509,7 +488,6 @@ impl DataTable { .collect::>(), ), col_entity_path[i].clone(), - col_num_instances[i].into(), cells, ) }) @@ -557,7 +535,6 @@ impl SizeBytes for DataTable { col_row_id, col_timelines, col_entity_path, - col_num_instances, columns, } = self; @@ -565,7 +542,6 @@ impl SizeBytes for DataTable { + col_row_id.heap_size_bytes() + col_timelines.heap_size_bytes() + col_entity_path.heap_size_bytes() - + col_num_instances.heap_size_bytes() + columns.heap_size_bytes() } } @@ -651,7 +627,6 @@ impl DataTable { col_row_id: _, col_timelines, col_entity_path: _, - col_num_instances: _, columns: _, } = self; @@ -680,7 +655,6 @@ impl DataTable { col_row_id, col_timelines: _, col_entity_path, - col_num_instances, columns: _, } = self; @@ -696,11 +670,6 @@ impl DataTable { schema.fields.push(entity_path_field); columns.push(entity_path_column); - let (num_instances_field, num_instances_column) = - Self::serialize_control_column(col_num_instances)?; - schema.fields.push(num_instances_field); - columns.push(num_instances_column); - schema.metadata = [(TableId::name().to_string(), table_id.to_string())].into(); Ok((schema, columns)) @@ -768,7 +737,6 @@ impl DataTable { col_row_id: _, col_timelines: _, col_entity_path: _, - col_num_instances: _, columns: table, } = self; @@ -957,12 +925,6 @@ impl DataTable { .unwrap() .as_ref(), )?; - let col_num_instances = NumInstances::from_arrow( - chunk - .get(control_index(NumInstances::name().as_str())?) - .unwrap() - .as_ref(), - )?; // --- Components --- @@ -993,7 +955,6 @@ impl DataTable { col_row_id: col_row_id.into(), col_timelines, col_entity_path: col_entity_path.into(), - col_num_instances: col_num_instances.into(), columns, }) } @@ -1160,14 +1121,12 @@ impl DataTable { row_id: _, timepoint: timepoint1, entity_path: entity_path1, - num_instances: num_instances1, cells: ref cells1, } = row1; let DataRow { row_id: _, timepoint: timepoint2, entity_path: entity_path2, - num_instances: num_instances2, cells: ref cells2, } = row2; @@ -1244,7 +1203,6 @@ impl DataTable { RowId::ZERO, "cell", TimePoint::default(), - cell.num_instances(), cell, ) .unwrap(); @@ -1286,10 +1244,7 @@ impl DataTable { } anyhow::ensure!( - timepoint1 == timepoint2 - && entity_path1 == entity_path2 - && num_instances1 == num_instances2 - && cells1 == cells2, + timepoint1 == timepoint2 && entity_path1 == entity_path2 && cells1 == cells2, "Found discrepancy in row #{ri}:\n{}\n{}\ \n\nrow1:\n{row1} \n\nrow2:\n{row2}", @@ -1334,41 +1289,25 @@ impl DataTable { }; let row0 = { - let num_instances = 2; let positions: &[MyPoint] = &[MyPoint::new(10.0, 10.0), MyPoint::new(20.0, 20.0)]; let colors: &[_] = &[MyColor(0x8080_80FF)]; let labels: &[MyLabel] = &[]; - DataRow::from_cells3( - RowId::new(), - "a", - timepoint(1), - num_instances, - (positions, colors, labels), - ) - .unwrap() + DataRow::from_cells3(RowId::new(), "a", timepoint(1), (positions, colors, labels)) + .unwrap() }; let row1 = { - let num_instances = 0; let colors: &[MyColor] = &[]; - DataRow::from_cells1(RowId::new(), "b", timepoint(1), num_instances, colors).unwrap() + DataRow::from_cells1(RowId::new(), "b", timepoint(1), colors).unwrap() }; let row2 = { - let num_instances = 1; let colors: &[_] = &[MyColor(0xFFFF_FFFF)]; let labels: &[_] = &[MyLabel("hey".into())]; - DataRow::from_cells2( - RowId::new(), - "c", - timepoint(2), - num_instances, - (colors, labels), - ) - .unwrap() + DataRow::from_cells2(RowId::new(), "c", timepoint(2), (colors, labels)).unwrap() }; let mut table = DataTable::from_rows(table_id, [row0, row1, row2]); diff --git a/crates/re_log_types/src/example_components.rs b/crates/re_log_types/src/example_components.rs index dc7bd44da0cae..2cc5b2ac3cf5a 100644 --- a/crates/re_log_types/src/example_components.rs +++ b/crates/re_log_types/src/example_components.rs @@ -2,7 +2,7 @@ use std::sync::Arc; -use re_types_core::{components::InstanceKey, Loggable, SizeBytes}; +use re_types_core::{Loggable, SizeBytes}; // ---------------------------------------------------------------------------- @@ -27,7 +27,6 @@ impl re_types_core::Archetype for MyPoints { fn recommended_components() -> std::borrow::Cow<'static, [re_types_core::ComponentName]> { vec![ re_types_core::LoggableBatch::name(&Self::Indicator::default()), - InstanceKey::name(), MyColor::name(), MyLabel::name(), ] @@ -243,3 +242,63 @@ impl Loggable for MyLabel { .collect()) } } + +// ---------------------------------------------------------------------------- + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] +#[repr(transparent)] +pub struct MyIndex(pub u64); + +impl MyIndex { + #[allow(clippy::should_implement_trait)] + #[inline] + pub fn from_iter(it: impl IntoIterator) -> Vec { + it.into_iter().map(Self).collect() + } +} + +re_types_core::macros::impl_into_cow!(MyIndex); + +impl SizeBytes for MyIndex { + #[inline] + fn heap_size_bytes(&self) -> u64 { + let Self(_) = self; + 0 + } +} + +impl Loggable for MyIndex { + type Name = re_types_core::ComponentName; + + fn name() -> Self::Name { + "example.MyIndex".into() + } + + fn arrow_datatype() -> arrow2::datatypes::DataType { + arrow2::datatypes::DataType::UInt64 + } + + fn to_arrow_opt<'a>( + data: impl IntoIterator>>>, + ) -> re_types_core::SerializationResult> + where + Self: 'a, + { + use re_types_core::datatypes::UInt64; + UInt64::to_arrow_opt( + data.into_iter() + .map(|opt| opt.map(Into::into).map(|c| UInt64(c.0))), + ) + } + + fn from_arrow_opt( + data: &dyn arrow2::array::Array, + ) -> re_types_core::DeserializationResult>> { + use re_types_core::datatypes::UInt64; + Ok(UInt64::from_arrow_opt(data)? + .into_iter() + .map(|opt| opt.map(|v| Self(v.0))) + .collect()) + } +} diff --git a/crates/re_log_types/src/lib.rs b/crates/re_log_types/src/lib.rs index 22f90cb7141cf..c65f939d97c1b 100644 --- a/crates/re_log_types/src/lib.rs +++ b/crates/re_log_types/src/lib.rs @@ -8,8 +8,8 @@ //! Some components, mostly transform related ones, are "mono-components". //! This means that Rerun makes assumptions that depend on this component //! only taking on a singular value for all instances of an Entity. Where possible, -//! exposed APIs will force these components to be logged as a singular instance -//! or a splat. However, it is an error with undefined behavior to manually use lower-level +//! exposed APIs will force these components to be logged as a singular instance. +//! However, it is an error with undefined behavior to manually use lower-level //! APIs to log a batched mono-component. //! //! This requirement is especially apparent with transforms: @@ -18,15 +18,15 @@ //! `foo.transform * foo/bar.transform * foo/bar/baz.transform`. pub mod arrow_msg; -mod data_cell; -mod data_row; -mod data_table; pub mod example_components; pub mod hash; -mod num_instances; pub mod path; -mod time; pub mod time_point; + +mod data_cell; +mod data_row; +mod data_table; +mod time; mod time_range; mod time_real; mod vec_deque_ext; @@ -44,10 +44,9 @@ pub use self::data_row::{ }; pub use self::data_table::{ DataCellColumn, DataCellOptVec, DataTable, DataTableError, DataTableResult, EntityPathVec, - ErasedTimeVec, NumInstancesVec, RowIdVec, TableId, TimePointVec, METADATA_KIND, - METADATA_KIND_CONTROL, METADATA_KIND_DATA, + ErasedTimeVec, RowIdVec, TableId, TimePointVec, METADATA_KIND, METADATA_KIND_CONTROL, + METADATA_KIND_DATA, }; -pub use self::num_instances::NumInstances; pub use self::path::*; pub use self::time::{Duration, Time, TimeZone}; pub use self::time_point::{ @@ -139,7 +138,7 @@ impl Instance { self.is_specific().then_some(self) } - /// Creates a new [`InstanceKey`] that identifies a 2D coordinate. + /// Creates a new [`Instance`] that identifies a 2D coordinate. #[inline] pub fn from_2d_image_coordinate([x, y]: [u32; 2], image_width: u64) -> Self { Self((x as u64) + (y as u64) * image_width) diff --git a/crates/re_log_types/src/num_instances.rs b/crates/re_log_types/src/num_instances.rs deleted file mode 100644 index 0ac0e57fbb609..0000000000000 --- a/crates/re_log_types/src/num_instances.rs +++ /dev/null @@ -1,92 +0,0 @@ -use re_types_core::{Loggable, SizeBytes}; - -// --- - -/// Explicit number of instances in a [`crate::DataRow`]. -/// -/// Component batches in that row should have a length of either this number, zero (clear) or one (splat). -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, bytemuck::Pod, bytemuck::Zeroable)] -#[repr(transparent)] -pub struct NumInstances(pub u32); - -impl NumInstances { - #[inline] - pub fn get(self) -> u32 { - self.0 - } -} - -impl From for u32 { - #[inline] - fn from(val: NumInstances) -> Self { - val.0 - } -} - -impl From for NumInstances { - #[inline] - fn from(value: u32) -> Self { - Self(value) - } -} - -impl SizeBytes for NumInstances { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -re_types_core::macros::impl_into_cow!(NumInstances); - -impl Loggable for NumInstances { - type Name = re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.controls.NumInstances".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - re_types_core::datatypes::UInt32::arrow_datatype() - } - - fn to_arrow_opt<'a>( - _data: impl IntoIterator>>>, - ) -> re_types_core::SerializationResult> - where - Self: 'a, - { - Err(re_types_core::SerializationError::not_implemented( - Self::name(), - "NumInstances is never nullable, use `to_arrow()` instead", - )) - } - - #[inline] - fn to_arrow<'a>( - data: impl IntoIterator>>, - ) -> re_types_core::SerializationResult> - where - Self: 'a, - { - use re_types_core::datatypes::UInt32; - UInt32::to_arrow(data.into_iter().map(Into::into).map(|c| UInt32(c.0))) - } - - fn from_arrow( - array: &dyn ::arrow2::array::Array, - ) -> re_types_core::DeserializationResult> { - use re_types_core::datatypes::UInt32; - Ok(UInt32::from_arrow(array)? - .into_iter() - .map(|v| Self(v.0)) - .collect()) - } -} diff --git a/crates/re_log_types/src/path/data_path.rs b/crates/re_log_types/src/path/data_path.rs index 68046c88f90a5..9b2a928774c55 100644 --- a/crates/re_log_types/src/path/data_path.rs +++ b/crates/re_log_types/src/path/data_path.rs @@ -1,11 +1,11 @@ -use re_types_core::{components::InstanceKey, ComponentName}; +use re_types_core::ComponentName; -use crate::EntityPath; +use crate::{EntityPath, Instance}; /// A general path to some data. /// -/// This always starts with an [`EntityPath`], followed -/// by an optional [`InstanceKey`], followed by an optional [`ComponentName`]. +/// This always starts with an [`EntityPath`], followed by an optional instance index, +/// followed by an optional [`ComponentName`]. /// /// For instance: /// @@ -16,17 +16,15 @@ use crate::EntityPath; #[derive(Clone, Eq, PartialEq, Hash)] pub struct DataPath { pub entity_path: EntityPath, - - pub instance_key: Option, - + pub instance: Option, pub component_name: Option, } impl std::fmt::Display for DataPath { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.entity_path.fmt(f)?; - if let Some(instance_key) = &self.instance_key { - write!(f, "[#{}]", instance_key.0)?; + if let Some(instance) = &self.instance { + write!(f, "[#{instance}]")?; } if let Some(component_name) = &self.component_name { write!(f, ":{component_name:?}")?; diff --git a/crates/re_log_types/src/path/parse_path.rs b/crates/re_log_types/src/path/parse_path.rs index 60928c3e15792..9aeb124c6444b 100644 --- a/crates/re_log_types/src/path/parse_path.rs +++ b/crates/re_log_types/src/path/parse_path.rs @@ -1,8 +1,8 @@ use std::str::FromStr; -use re_types_core::{components::InstanceKey, ComponentName}; +use re_types_core::ComponentName; -use crate::{ComponentPath, DataPath, EntityPath, EntityPathPart}; +use crate::{ComponentPath, DataPath, EntityPath, EntityPathPart, Instance}; #[derive(thiserror::Error, Debug, PartialEq, Eq)] pub enum PathParseError { @@ -24,11 +24,11 @@ pub enum PathParseError { #[error("Empty part")] EmptyPart, - #[error("Invalid instance key: {0:?} (expected '[#1234]')")] - BadInstanceKey(String), + #[error("Invalid instance index: {0:?} (expected '[#1234]')")] + BadInstance(String), - #[error("Found an unexpected instance key: [#{}]", 0.0)] - UnexpectedInstanceKey(InstanceKey), + #[error("Found an unexpected instance index: [#{}]", 0)] + UnexpectedInstance(Instance), #[error("Found an unexpected trailing component name: {0:?}")] UnexpectedComponentName(ComponentName), @@ -74,7 +74,7 @@ impl std::str::FromStr for DataPath { let mut tokens = tokenize_data_path(path); let mut component_name = None; - let mut instance_key = None; + let mut instance = None; // Parse `:rerun.components.Color` suffix: if let Some(colon) = tokens.iter().position(|&token| token == ":") { @@ -94,23 +94,19 @@ impl std::str::FromStr for DataPath { // Parse `[#1234]` suffix: if let Some(bracket) = tokens.iter().position(|&token| token == "[") { - let instance_key_tokens = &tokens[bracket..]; - if instance_key_tokens.len() != 3 || instance_key_tokens.last() != Some(&"]") { - return Err(PathParseError::BadInstanceKey(join(instance_key_tokens))); + let instance_tokens = &tokens[bracket..]; + if instance_tokens.len() != 3 || instance_tokens.last() != Some(&"]") { + return Err(PathParseError::BadInstance(join(instance_tokens))); } - let instance_key_token = instance_key_tokens[1]; - if let Some(nr) = instance_key_token.strip_prefix('#') { + let instance_token = instance_tokens[1]; + if let Some(nr) = instance_token.strip_prefix('#') { if let Ok(nr) = u64::from_str(nr) { - instance_key = Some(InstanceKey(nr)); + instance = Some(nr); } else { - return Err(PathParseError::BadInstanceKey( - instance_key_token.to_owned(), - )); + return Err(PathParseError::BadInstance(instance_token.to_owned())); } } else { - return Err(PathParseError::BadInstanceKey( - instance_key_token.to_owned(), - )); + return Err(PathParseError::BadInstance(instance_token.to_owned())); } tokens.truncate(bracket); } @@ -123,7 +119,7 @@ impl std::str::FromStr for DataPath { Ok(Self { entity_path, - instance_key, + instance: instance.map(Into::into), component_name, }) } @@ -148,12 +144,12 @@ impl EntityPath { pub fn parse_strict(input: &str) -> Result { let DataPath { entity_path, - instance_key, + instance, component_name, } = DataPath::from_str(input)?; - if let Some(instance_key) = instance_key { - return Err(PathParseError::UnexpectedInstanceKey(instance_key)); + if let Some(instance) = instance { + return Err(PathParseError::UnexpectedInstance(instance)); } if let Some(component_name) = component_name { return Err(PathParseError::UnexpectedComponentName(component_name)); @@ -196,12 +192,12 @@ impl FromStr for ComponentPath { fn from_str(s: &str) -> Result { let DataPath { entity_path, - instance_key, + instance, component_name, } = DataPath::from_str(s)?; - if let Some(instance_key) = instance_key { - return Err(PathParseError::UnexpectedInstanceKey(instance_key)); + if let Some(instance) = instance { + return Err(PathParseError::UnexpectedInstance(instance)); } let Some(component_name) = component_name else { @@ -366,7 +362,7 @@ fn test_parse_entity_path_strict() { )); assert!(matches!( parse(r#"entity[#123]"#), - Err(PathParseError::UnexpectedInstanceKey(InstanceKey(123))) + Err(PathParseError::UnexpectedInstance(Instance(123))) )); assert_eq!(parse("hallådär"), Ok(entity_path_vec!("hallådär"))); @@ -405,7 +401,7 @@ fn test_parse_component_path() { ); assert_eq!( ComponentPath::from_str("world/points[#42]:rerun.components.Color"), - Err(PathParseError::UnexpectedInstanceKey(InstanceKey(42))) + Err(PathParseError::UnexpectedInstance(Instance(42))) ); } @@ -415,7 +411,7 @@ fn test_parse_data_path() { DataPath::from_str("world/points[#42]:rerun.components.Color"), Ok(DataPath { entity_path: EntityPath::from("world/points"), - instance_key: Some(InstanceKey(42)), + instance: Some(Instance(42)), component_name: Some("rerun.components.Color".into()), }) ); @@ -423,7 +419,7 @@ fn test_parse_data_path() { DataPath::from_str("world/points:rerun.components.Color"), Ok(DataPath { entity_path: EntityPath::from("world/points"), - instance_key: None, + instance: None, component_name: Some("rerun.components.Color".into()), }) ); @@ -431,7 +427,7 @@ fn test_parse_data_path() { DataPath::from_str("world/points[#42]"), Ok(DataPath { entity_path: EntityPath::from("world/points"), - instance_key: Some(InstanceKey(42)), + instance: Some(Instance(42)), component_name: None, }) ); @@ -439,7 +435,7 @@ fn test_parse_data_path() { DataPath::from_str("world/points"), Ok(DataPath { entity_path: EntityPath::from("world/points"), - instance_key: None, + instance: None, component_name: None, }) ); diff --git a/crates/re_query/benches/latest_at.rs b/crates/re_query/benches/latest_at.rs index feba6dde04f67..d0fbf24d9df4b 100644 --- a/crates/re_query/benches/latest_at.rs +++ b/crates/re_query/benches/latest_at.rs @@ -10,7 +10,7 @@ use re_query::{clamped_zip_1x1, PromiseResolver}; use re_query::{Caches, LatestAtResults}; use re_types::{ archetypes::Points2D, - components::{Color, InstanceKey, Position2D, Text}, + components::{Color, Position2D, Text}, Archetype as _, }; use re_types_core::Loggable as _; @@ -206,7 +206,6 @@ fn build_points_rows(paths: &[EntityPath], num_points: usize) -> Vec { RowId::new(), path.clone(), [build_frame_nr((frame_idx as i64).try_into().unwrap())], - num_points as _, ( build_some_point2d(num_points), build_some_colors(num_points), @@ -232,7 +231,6 @@ fn build_strings_rows(paths: &[EntityPath], num_strings: usize) -> Vec RowId::new(), path.clone(), [build_frame_nr((frame_idx as i64).try_into().unwrap())], - num_strings as _, // We still need to create points because they are the primary for the // archetype query we want to do. We won't actually deserialize the points // during the query -- we just need it for the primary keys. @@ -258,7 +256,6 @@ fn build_strings_rows(paths: &[EntityPath], num_strings: usize) -> Vec fn insert_rows<'a>(msgs: impl Iterator) -> (Caches, DataStore) { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); diff --git a/crates/re_query/examples/latest_at.rs b/crates/re_query/examples/latest_at.rs index eb450f091cc26..ab122fce1150d 100644 --- a/crates/re_query/examples/latest_at.rs +++ b/crates/re_query/examples/latest_at.rs @@ -106,7 +106,6 @@ fn main() -> anyhow::Result<()> { fn store() -> anyhow::Result { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - re_types::components::InstanceKey::name(), Default::default(), ); @@ -116,15 +115,15 @@ fn store() -> anyhow::Result { let timepoint = [build_frame_nr(123)]; let points = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, points)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, points)?; store.insert_row(&row)?; let colors = vec![MyColor::from_rgb(255, 0, 0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, colors)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, colors)?; store.insert_row(&row)?; let labels = vec![MyLabel("a".into()), MyLabel("b".into())]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, labels)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, labels)?; store.insert_row(&row)?; } diff --git a/crates/re_query/examples/latest_at_archetype.rs b/crates/re_query/examples/latest_at_archetype.rs index af3215fdc3bcd..c351333c86e71 100644 --- a/crates/re_query/examples/latest_at_archetype.rs +++ b/crates/re_query/examples/latest_at_archetype.rs @@ -5,7 +5,7 @@ use re_types::{ archetypes::Points2D, components::{Color, Position2D, Text}, }; -use re_types_core::{Archetype as _, Loggable as _}; +use re_types_core::Archetype as _; use re_query::{clamped_zip_1x2, LatestAtResults, PromiseResolver, PromiseResult}; @@ -79,7 +79,6 @@ fn main() -> anyhow::Result<()> { fn store() -> anyhow::Result { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - re_types::components::InstanceKey::name(), Default::default(), ); @@ -89,15 +88,15 @@ fn store() -> anyhow::Result { let timepoint = [build_frame_nr(123)]; let points = vec![Position2D::new(1.0, 2.0), Position2D::new(3.0, 4.0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, points)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, points)?; store.insert_row(&row)?; let colors = vec![Color::from_rgb(255, 0, 0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, colors)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, colors)?; store.insert_row(&row)?; let labels = vec![Text("a".into()), Text("b".into())]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, labels)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, labels)?; store.insert_row(&row)?; } diff --git a/crates/re_query/examples/range.rs b/crates/re_query/examples/range.rs index 0defca92ed8a4..c083159e5ee3a 100644 --- a/crates/re_query/examples/range.rs +++ b/crates/re_query/examples/range.rs @@ -109,7 +109,6 @@ fn main() -> anyhow::Result<()> { fn store() -> anyhow::Result { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - re_types::components::InstanceKey::name(), Default::default(), ); @@ -119,15 +118,15 @@ fn store() -> anyhow::Result { let timepoint = [build_frame_nr(123)]; let points = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, points)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, points)?; store.insert_row(&row)?; let colors = vec![MyColor::from_rgb(255, 0, 0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, colors)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, colors)?; store.insert_row(&row)?; let labels = vec![MyLabel("a".into()), MyLabel("b".into())]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, labels)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, labels)?; store.insert_row(&row)?; } @@ -135,7 +134,7 @@ fn store() -> anyhow::Result { let timepoint = [build_frame_nr(456)]; let colors = vec![MyColor::from_rgb(255, 0, 0), MyColor::from_rgb(0, 0, 255)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, colors)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, colors)?; store.insert_row(&row)?; let points = vec![ @@ -143,7 +142,7 @@ fn store() -> anyhow::Result { MyPoint::new(30.0, 40.0), MyPoint::new(50.0, 60.0), ]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, points)?; + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, points)?; store.insert_row(&row)?; } diff --git a/crates/re_query/src/latest_at/results.rs b/crates/re_query/src/latest_at/results.rs index 7bb7e57133c13..fe2170afa327e 100644 --- a/crates/re_query/src/latest_at/results.rs +++ b/crates/re_query/src/latest_at/results.rs @@ -98,13 +98,8 @@ impl LatestAtResults { // NOTE: Since this is a compound API that actually emits multiple queries, the index of the // final result is the most recent index among all of its components, as defined by time // and row-id order. - // - // TODO(#5303): We have to ignore the cluster key in this piece of logic for backwards compatibility - // reasons with the legacy instance-key model. This will go away next. - use re_types_core::Loggable as _; - if component_name != re_types_core::components::InstanceKey::name() - && cached.index > self.compound_index - { + + if cached.index > self.compound_index { self.compound_index = cached.index; } diff --git a/crates/re_query/src/lib.rs b/crates/re_query/src/lib.rs index 1f6d81b4d3b07..0d9116b54c61a 100644 --- a/crates/re_query/src/lib.rs +++ b/crates/re_query/src/lib.rs @@ -131,8 +131,6 @@ pub fn cacheable(component_name: re_types::ComponentName) -> bool { use re_types_core::Loggable as _; let not_cacheable = NOT_CACHEABLE.get_or_init(|| { [ - // TODO(#5303): instance keys are on their way out anyhow. - re_types::components::InstanceKey::name(), // TODO(#5974): tensors might already be cached in the ad-hoc JPEG cache, we don't // want yet another copy. re_types::components::TensorData::name(), diff --git a/crates/re_query/tests/latest_at.rs b/crates/re_query/tests/latest_at.rs index b5df7aca1826f..115aa0f7cf6cb 100644 --- a/crates/re_query/tests/latest_at.rs +++ b/crates/re_query/tests/latest_at.rs @@ -7,7 +7,7 @@ use re_log_types::{ use re_query::Caches; use re_query::PromiseResolver; use re_types::Archetype as _; -use re_types_core::{components::InstanceKey, Loggable as _}; +use re_types_core::Loggable as _; // --- @@ -15,7 +15,6 @@ use re_types_core::{components::InstanceKey, Loggable as _}; fn simple_query() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -24,13 +23,13 @@ fn simple_query() { let timepoint = [build_frame_nr(123)]; let points = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, points.clone()) - .unwrap(); + let row = + DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, points.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row); let colors = vec![MyColor::from_rgb(255, 0, 0)]; - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, colors.clone()) - .unwrap(); + let row = + DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, colors.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row); let query = re_data_store::LatestAtQuery::new(timepoint[0].0, timepoint[0].1); @@ -52,7 +51,6 @@ fn simple_query() { fn static_query() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -61,8 +59,8 @@ fn static_query() { let timepoint = [build_frame_nr(123)]; let points = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row1 = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 2, points.clone()) - .unwrap(); + let row1 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, points.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row1); let colors = vec![MyColor::from_rgb(255, 0, 0)]; @@ -70,7 +68,6 @@ fn static_query() { RowId::new(), entity_path, TimePoint::default(), - 1, colors.clone(), ) .unwrap(); @@ -110,7 +107,6 @@ fn invalidation() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -120,7 +116,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 2, points.clone(), ) .unwrap(); @@ -131,7 +126,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 1, colors.clone(), ) .unwrap(); @@ -158,7 +152,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 2, points.clone(), ) .unwrap(); @@ -183,7 +176,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 2, colors.clone(), ) .unwrap(); @@ -210,7 +202,6 @@ fn invalidation() { RowId::new(), entity_path, past_data_timepoint.clone(), - 2, points_past.clone(), ) .unwrap(); @@ -239,7 +230,6 @@ fn invalidation() { RowId::new(), entity_path, past_data_timepoint, - 2, colors_past.clone(), ) .unwrap(); @@ -268,7 +258,6 @@ fn invalidation() { RowId::new(), entity_path, future_data_timepoint.clone(), - 2, points_future.clone(), ) .unwrap(); @@ -295,7 +284,6 @@ fn invalidation() { RowId::new(), entity_path, future_data_timepoint, - 1, colors_future, ) .unwrap(); @@ -366,7 +354,6 @@ fn invalidation() { fn invalidation_of_future_optionals() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -381,7 +368,7 @@ fn invalidation_of_future_optionals() { let points = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; let row1 = - DataRow::from_cells1_sized(RowId::new(), entity_path, static_, 2, points.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, static_, points.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row1); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); @@ -400,7 +387,7 @@ fn invalidation_of_future_optionals() { let colors = vec![MyColor::from_rgb(255, 0, 0)]; let row2 = - DataRow::from_cells1_sized(RowId::new(), entity_path, frame2, 1, colors.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, frame2, colors.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row2); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); @@ -419,7 +406,7 @@ fn invalidation_of_future_optionals() { let colors = vec![MyColor::from_rgb(0, 0, 255)]; let row3 = - DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, 1, colors.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, colors.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row3); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); @@ -438,7 +425,7 @@ fn invalidation_of_future_optionals() { let colors = vec![MyColor::from_rgb(0, 255, 0)]; let row4 = - DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, 1, colors.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, colors.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row4); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); @@ -460,7 +447,6 @@ fn invalidation_of_future_optionals() { fn static_invalidation() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -472,14 +458,9 @@ fn static_invalidation() { let query_time = [build_frame_nr(9999)]; let points = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row1 = DataRow::from_cells1_sized( - RowId::new(), - entity_path, - timeless.clone(), - 2, - points.clone(), - ) - .unwrap(); + let row1 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless.clone(), points.clone()) + .unwrap(); insert_and_react(&mut store, &mut caches, &row1); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); @@ -497,14 +478,9 @@ fn static_invalidation() { ); let colors = vec![MyColor::from_rgb(255, 0, 0)]; - let row2 = DataRow::from_cells1_sized( - RowId::new(), - entity_path, - timeless.clone(), - 1, - colors.clone(), - ) - .unwrap(); + let row2 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless.clone(), colors.clone()) + .unwrap(); insert_and_react(&mut store, &mut caches, &row2); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); @@ -523,7 +499,7 @@ fn static_invalidation() { let colors = vec![MyColor::from_rgb(0, 0, 255)]; let row3 = - DataRow::from_cells1_sized(RowId::new(), entity_path, timeless, 1, colors.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless, colors.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row3); let query = re_data_store::LatestAtQuery::new(query_time[0].0, query_time[0].1); diff --git a/crates/re_query/tests/range.rs b/crates/re_query/tests/range.rs index 615e48005d29c..efcf94683cfba 100644 --- a/crates/re_query/tests/range.rs +++ b/crates/re_query/tests/range.rs @@ -7,7 +7,7 @@ use re_log_types::{ DataRow, EntityPath, RowId, TimePoint, }; use re_query::{Caches, PromiseResolver, PromiseResult}; -use re_types::{components::InstanceKey, Archetype}; +use re_types::Archetype; use re_types_core::Loggable as _; // --- @@ -16,7 +16,6 @@ use re_types_core::Loggable as _; fn simple_range() -> anyhow::Result<()> { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -29,7 +28,6 @@ fn simple_range() -> anyhow::Result<()> { RowId::new(), entity_path.clone(), timepoint1, - 2, points1.clone(), )?; insert_and_react(&mut store, &mut caches, &row1_1); @@ -38,7 +36,6 @@ fn simple_range() -> anyhow::Result<()> { RowId::new(), entity_path.clone(), timepoint1, - 1, colors1.clone(), )?; insert_and_react(&mut store, &mut caches, &row1_2); @@ -49,7 +46,6 @@ fn simple_range() -> anyhow::Result<()> { RowId::new(), entity_path.clone(), timepoint2, - 1, colors2.clone(), )?; insert_and_react(&mut store, &mut caches, &row2); @@ -60,7 +56,6 @@ fn simple_range() -> anyhow::Result<()> { RowId::new(), entity_path.clone(), timepoint3, - 2, points3.clone(), )?; insert_and_react(&mut store, &mut caches, &row3); @@ -136,7 +131,6 @@ fn simple_range() -> anyhow::Result<()> { fn static_range() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -149,7 +143,6 @@ fn static_range() { RowId::new(), entity_path.clone(), timepoint1, - 2, points1.clone(), ) .unwrap(); @@ -159,7 +152,6 @@ fn static_range() { RowId::new(), entity_path.clone(), timepoint1, - 1, colors1.clone(), ) .unwrap(); @@ -169,7 +161,6 @@ fn static_range() { RowId::new(), entity_path.clone(), TimePoint::default(), - 1, colors1.clone(), ) .unwrap(); @@ -181,7 +172,6 @@ fn static_range() { RowId::new(), entity_path.clone(), timepoint2, - 1, colors2.clone(), ) .unwrap(); @@ -191,7 +181,6 @@ fn static_range() { RowId::new(), entity_path.clone(), TimePoint::default(), - 1, colors2.clone(), ) .unwrap(); @@ -204,7 +193,6 @@ fn static_range() { RowId::new(), entity_path.clone(), timepoint3, - 2, points3.clone(), ) .unwrap(); @@ -305,7 +293,6 @@ fn invalidation() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -315,7 +302,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 2, points1.clone(), ) .unwrap(); @@ -326,7 +312,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 1, colors2.clone(), ) .unwrap(); @@ -355,7 +340,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint.clone(), - 2, points3.clone(), ) .unwrap(); @@ -383,7 +367,6 @@ fn invalidation() { RowId::new(), entity_path, present_data_timepoint, - 2, colors4.clone(), ) .unwrap(); @@ -414,7 +397,6 @@ fn invalidation() { RowId::new(), entity_path, past_data_timepoint.clone(), - 2, points5.clone(), ) .unwrap(); @@ -452,7 +434,6 @@ fn invalidation() { RowId::new(), entity_path, past_data_timepoint.clone(), - 2, colors6.clone(), ) .unwrap(); @@ -488,7 +469,6 @@ fn invalidation() { RowId::new(), entity_path, future_data_timepoint.clone(), - 2, points7.clone(), ) .unwrap(); @@ -523,7 +503,6 @@ fn invalidation() { RowId::new(), entity_path, future_data_timepoint, - 1, colors8.clone(), ) .unwrap(); @@ -602,7 +581,6 @@ fn invalidation() { fn invalidation_of_future_optionals() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -616,8 +594,8 @@ fn invalidation_of_future_optionals() { let query = re_data_store::RangeQuery::new(frame2[0].0, TimeRange::EVERYTHING); let points1 = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row1 = DataRow::from_cells1_sized(RowId::new(), entity_path, timeless, 2, points1.clone()) - .unwrap(); + let row1 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless, points1.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row1); let expected_points = &[ @@ -635,7 +613,7 @@ fn invalidation_of_future_optionals() { let colors2 = vec![MyColor::from_rgb(255, 0, 0)]; let row2 = - DataRow::from_cells1_sized(RowId::new(), entity_path, frame2, 1, colors2.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, frame2, colors2.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row2); let expected_colors = &[ @@ -655,7 +633,7 @@ fn invalidation_of_future_optionals() { let colors3 = vec![MyColor::from_rgb(0, 0, 255)]; let row3 = - DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, 1, colors3.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, colors3.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row3); let expected_colors = &[ @@ -679,7 +657,7 @@ fn invalidation_of_future_optionals() { let colors4 = vec![MyColor::from_rgb(0, 255, 0)]; let row4 = - DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, 1, colors4.clone()).unwrap(); + DataRow::from_cells1_sized(RowId::new(), entity_path, frame3, colors4.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row4); let expected_colors = &[ @@ -710,7 +688,6 @@ fn invalidation_of_future_optionals() { fn invalidation_static() { let mut store = DataStore::new( re_log_types::StoreId::random(re_log_types::StoreKind::Recording), - InstanceKey::name(), Default::default(), ); let mut caches = Caches::new(&store); @@ -723,14 +700,9 @@ fn invalidation_static() { let query = re_data_store::RangeQuery::new(frame0[0].0, TimeRange::EVERYTHING); let points1 = vec![MyPoint::new(1.0, 2.0), MyPoint::new(3.0, 4.0)]; - let row1 = DataRow::from_cells1_sized( - RowId::new(), - entity_path, - timeless.clone(), - 2, - points1.clone(), - ) - .unwrap(); + let row1 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless.clone(), points1.clone()) + .unwrap(); insert_and_react(&mut store, &mut caches, &row1); let expected_points = &[ @@ -747,14 +719,9 @@ fn invalidation_static() { ); let colors2 = vec![MyColor::from_rgb(255, 0, 0)]; - let row2 = DataRow::from_cells1_sized( - RowId::new(), - entity_path, - timeless.clone(), - 1, - colors2.clone(), - ) - .unwrap(); + let row2 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless.clone(), colors2.clone()) + .unwrap(); insert_and_react(&mut store, &mut caches, &row2); let expected_colors = &[ @@ -770,8 +737,8 @@ fn invalidation_static() { ); let colors3 = vec![MyColor::from_rgb(0, 0, 255)]; - let row3 = DataRow::from_cells1_sized(RowId::new(), entity_path, timeless, 1, colors3.clone()) - .unwrap(); + let row3 = + DataRow::from_cells1_sized(RowId::new(), entity_path, timeless, colors3.clone()).unwrap(); insert_and_react(&mut store, &mut caches, &row3); let expected_colors = &[ diff --git a/crates/re_sdk/src/lib.rs b/crates/re_sdk/src/lib.rs index 21f533a3a1139..9c264b489f73a 100644 --- a/crates/re_sdk/src/lib.rs +++ b/crates/re_sdk/src/lib.rs @@ -33,7 +33,7 @@ pub use self::recording_stream::{ pub use re_sdk_comms::{default_flush_timeout, default_server_addr}; pub use re_log_types::{ - entity_path, ApplicationId, EntityPath, EntityPathPart, StoreId, StoreKind, + entity_path, ApplicationId, EntityPath, EntityPathPart, Instance, StoreId, StoreKind, }; pub use re_memory::MemoryLimit; diff --git a/crates/re_sdk/src/recording_stream.rs b/crates/re_sdk/src/recording_stream.rs index c0affed8233f2..659668bc15b9a 100644 --- a/crates/re_sdk/src/recording_stream.rs +++ b/crates/re_sdk/src/recording_stream.rs @@ -14,7 +14,7 @@ use re_log_types::{ EntityPath, LogMsg, RowId, StoreId, StoreInfo, StoreKind, StoreSource, Time, TimeInt, TimePoint, TimeType, Timeline, TimelineName, }; -use re_types_core::{components::InstanceKey, AsComponents, ComponentBatch, SerializationError}; +use re_types_core::{AsComponents, ComponentBatch, SerializationError}; #[cfg(feature = "web_viewer")] use re_web_viewer_server::WebViewerServerPort; @@ -1015,11 +1015,9 @@ impl RecordingStream { let ent_path = ent_path.into(); - let mut num_instances = 0; let comp_batches: Result, _> = comp_batches .into_iter() .map(|comp_batch| { - num_instances = usize::max(num_instances, comp_batch.num_instances()); comp_batch .to_arrow() .map(|array| (comp_batch.arrow_field(), array)) @@ -1041,55 +1039,13 @@ impl RecordingStream { .collect(); let cells = cells?; - let mut instanced: Vec = Vec::new(); - let mut splatted: Vec = Vec::new(); - - for cell in cells { - if num_instances > 1 && cell.num_instances() == 1 { - splatted.push(cell); - } else { - instanced.push(cell); - } - } - // NOTE: The timepoint is irrelevant, the `RecordingStream` will overwrite it using its // internal clock. let timepoint = TimePoint::default(); - // TODO(#1893): unsplit splats once new data cells are in - let splatted = if splatted.is_empty() { - None - } else { - splatted.push(DataCell::from_native([InstanceKey::SPLAT])); - Some(DataRow::from_cells( - row_id, - timepoint.clone(), - ent_path.clone(), - 1, - splatted, - )?) - }; - - let instanced = if instanced.is_empty() { - None - } else { - Some(DataRow::from_cells( - row_id.incremented_by(1), // we need a unique RowId from what is used for the splatted data - timepoint, - ent_path, - num_instances as _, - instanced, - )?) - }; - - if let Some(splatted) = splatted { - self.record_row(splatted, !static_); - } - - // Always the primary component last so range-based queries will include the other data. - // Since the primary component can't be splatted it must be in here, see(#1215). - if let Some(instanced) = instanced { - self.record_row(instanced, !static_); + if !cells.is_empty() { + let row = DataRow::from_cells(row_id, timepoint.clone(), ent_path.clone(), cells)?; + self.record_row(row, !static_); } Ok(()) diff --git a/crates/re_space_view/src/space_view.rs b/crates/re_space_view/src/space_view.rs index 8e435edeb6820..94936b7daaa86 100644 --- a/crates/re_space_view/src/space_view.rs +++ b/crates/re_space_view/src/space_view.rs @@ -236,7 +236,6 @@ impl SpaceViewBlueprint { RowId::new(), store_context.blueprint_timepoint_for_writes(), sub_path, - 1, info.components .keys() // It's important that we don't include the SpaceViewBlueprint's components @@ -482,7 +481,6 @@ mod tests { RowId::new(), path.clone(), TimePoint::default(), - 1, DataCell::from([component]), ) .unwrap(); diff --git a/crates/re_space_view_dataframe/src/space_view_class.rs b/crates/re_space_view_dataframe/src/space_view_class.rs index 448ee5e7cb8f4..10125fb50df1e 100644 --- a/crates/re_space_view_dataframe/src/space_view_class.rs +++ b/crates/re_space_view_dataframe/src/space_view_class.rs @@ -5,8 +5,7 @@ use egui_extras::Column; use re_data_store::{DataStore, LatestAtQuery}; use re_data_ui::item_ui::instance_path_button; use re_entity_db::{EntityProperties, InstancePath}; -use re_log_types::{EntityPath, Timeline}; -use re_types_core::components::InstanceKey; +use re_log_types::{EntityPath, Instance, Timeline}; use re_viewer_context::{ SpaceViewClass, SpaceViewClassIdentifier, SpaceViewClassRegistryError, SpaceViewState, SpaceViewSystemExecutionError, SystemExecutionOutput, UiVerbosity, ViewQuery, ViewerContext, @@ -33,10 +32,7 @@ impl SpaceViewClass for DataframeSpaceView { fn help_text(&self, _re_ui: &re_ui::ReUi) -> egui::WidgetText { "Show the data contained in entities in a table.\n\n\ - Each entity is represented by as many rows as it has instances. This includes out-of-bound \ - instances—instances from secondary components that cannot be joined to the primary \ - component—that are typically not represented in other space views. Also, splats are merged \ - into the entity's instance." + Each entity is represented by as many rows as it has instances." .into() } @@ -148,18 +144,12 @@ impl SpaceViewClass for DataframeSpaceView { let row_ui = |mut row: egui_extras::TableRow<'_, '_>| { let instance = &sorted_instance_paths[row.index()]; - // TODO(#4466): make it explicit if that instance key is "out - // of bounds" (aka cannot be joined to a primary component). - row.col(|ui| { instance_path_button(ctx, &latest_at_query, ctx.recording(), ui, None, instance); }); for component_name in &sorted_components { row.col(|ui| { - // TODO(#4466): make it explicit if that value results - // from a splat joint. - let results = ctx.recording().query_caches().latest_at( ctx.recording_store(), &latest_at_query, @@ -180,7 +170,7 @@ impl SpaceViewClass for DataframeSpaceView { ctx.recording(), &instance.entity_path, results, - &instance.instance_key, + &instance.instance, ); } else { ui.weak("-"); @@ -228,9 +218,6 @@ impl SpaceViewClass for DataframeSpaceView { } /// Returns a sorted, deduplicated iterator of all instance paths for a given entity. -/// -/// This includes _any_ instance key in all components logged under this entity path, excluding -/// splats. fn sorted_instance_paths_for<'a>( entity_path: &'a EntityPath, store: &'a DataStore, @@ -248,10 +235,9 @@ fn sorted_instance_paths_for<'a>( .map_or(0, |(_, _, cells)| { cells[0].as_ref().map_or(0, |cell| cell.num_instances()) }); - (0..num_instances).map(|i| InstanceKey(i as _)) + (0..num_instances).map(|i| Instance::from(i as u64)) }) - .filter(|instance_key| !instance_key.is_splat()) .collect::>() // dedup and sort .into_iter() - .map(|instance_key| InstancePath::instance(entity_path.clone(), instance_key)) + .map(|instance| InstancePath::instance(entity_path.clone(), instance)) } diff --git a/crates/re_space_view_spatial/src/instance_hash_conversions.rs b/crates/re_space_view_spatial/src/instance_hash_conversions.rs index 9a5c89bcb4177..19cf5b918c0c0 100644 --- a/crates/re_space_view_spatial/src/instance_hash_conversions.rs +++ b/crates/re_space_view_spatial/src/instance_hash_conversions.rs @@ -1,13 +1,12 @@ use re_entity_db::InstancePathHash; -use re_log_types::EntityPathHash; +use re_log_types::{EntityPathHash, Instance}; use re_renderer::{PickingLayerId, PickingLayerInstanceId, PickingLayerObjectId}; -use re_types::components::InstanceKey; #[inline] pub fn picking_layer_id_from_instance_path_hash(value: InstancePathHash) -> PickingLayerId { PickingLayerId { object: PickingLayerObjectId(value.entity_path_hash.hash64()), - instance: PickingLayerInstanceId(value.instance_key.0), + instance: PickingLayerInstanceId(value.instance.get()), } } @@ -15,6 +14,6 @@ pub fn picking_layer_id_from_instance_path_hash(value: InstancePathHash) -> Pick pub fn instance_path_hash_from_picking_layer_id(value: PickingLayerId) -> InstancePathHash { InstancePathHash { entity_path_hash: EntityPathHash::from_u64(value.object.0), - instance_key: InstanceKey(value.instance.0), + instance: Instance::from(value.instance.0), } } diff --git a/crates/re_space_view_spatial/src/picking.rs b/crates/re_space_view_spatial/src/picking.rs index 42732f0fd3426..b093d3a4d2f5b 100644 --- a/crates/re_space_view_spatial/src/picking.rs +++ b/crates/re_space_view_spatial/src/picking.rs @@ -2,8 +2,8 @@ use ahash::HashSet; use re_entity_db::InstancePathHash; +use re_log_types::Instance; use re_renderer::PickingLayerProcessor; -use re_types::components::InstanceKey; use crate::visualizers::ViewerImage; use crate::{eye::Eye, instance_hash_conversions::instance_path_hash_from_picking_layer_id}; @@ -269,7 +269,7 @@ fn picking_textured_rects(context: &PickingContext, images: &[ViewerImage]) -> V hits.push(PickingRayHit { instance_path_hash: InstancePathHash { entity_path_hash: image.ent_path.hash(), - instance_key: InstanceKey::from_2d_image_coordinate( + instance: Instance::from_2d_image_coordinate( [(u * width as f32) as u32, (v * height as f32) as u32], width as u64, ), diff --git a/crates/re_space_view_spatial/src/ui.rs b/crates/re_space_view_spatial/src/ui.rs index 53e822295b993..0d93c70e73a0a 100644 --- a/crates/re_space_view_spatial/src/ui.rs +++ b/crates/re_space_view_spatial/src/ui.rs @@ -4,9 +4,10 @@ use macaw::BoundingBox; use re_data_ui::{image_meaning_for_entity, item_ui, DataUi}; use re_data_ui::{show_zoomed_image_region, show_zoomed_image_region_area_outline}; use re_format::format_f32; +use re_log_types::Instance; use re_renderer::OutlineConfig; use re_space_view::ScreenshotMode; -use re_types::components::{DepthMeter, InstanceKey, TensorData, ViewCoordinates}; +use re_types::components::{DepthMeter, TensorData, ViewCoordinates}; use re_types::tensor_data::TensorDataMeaning; use re_viewer_context::{ HoverHighlight, Item, ItemSpaceContext, SelectionHighlight, SpaceViewHighlights, @@ -332,7 +333,7 @@ pub fn create_labels( let highlight = highlights .entity_highlight(label.labeled_instance.entity_path_hash) - .index_highlight(label.labeled_instance.instance_key); + .index_highlight(label.labeled_instance.instance); let fill_color = match highlight.hover { HoverHighlight::None => match highlight.selection { SelectionHighlight::None => parent_ui.style().visuals.widgets.inactive.bg_fill, @@ -478,7 +479,7 @@ pub fn picking( if response.double_clicked() { // Select entire entity on double-click: - instance_path.instance_key = InstanceKey::SPLAT; + instance_path.instance = Instance::ALL; } let interactive = ctx @@ -519,10 +520,8 @@ pub fn picking( } else { let tensor_path_hash = hit.instance_path_hash.versioned(tensor.row_id()); tensor.image_height_width_channels().map(|[_, w, _]| { - let coordinates = hit - .instance_path_hash - .instance_key - .to_2d_image_coordinate(w); + let coordinates = + hit.instance_path_hash.instance.to_2d_image_coordinate(w); (tensor_path_hash, tensor, meaning, coordinates) }) } @@ -532,7 +531,7 @@ pub fn picking( }; if picked_image_with_coords.is_some() { // We don't support selecting pixels yet. - instance_path.instance_key = InstanceKey::SPLAT; + instance_path.instance = Instance::ALL; } hovered_items.push(Item::DataResult(query.space_view_id, instance_path.clone())); diff --git a/crates/re_space_view_spatial/src/visualizers/arrows2d.rs b/crates/re_space_view_spatial/src/visualizers/arrows2d.rs index c2e027bd7a3ca..29c8ff247806f 100644 --- a/crates/re_space_view_spatial/src/visualizers/arrows2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/arrows2d.rs @@ -1,9 +1,10 @@ use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x6; use re_renderer::{renderer::LineStripFlags, LineDrawableBuilder, PickingLayerInstanceId}; use re_types::{ archetypes::Arrows2D, - components::{ClassId, Color, InstanceKey, KeypointId, Position2D, Radius, Text, Vector2D}, + components::{ClassId, Color, KeypointId, Position2D, Radius, Text, Vector2D}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -71,7 +72,7 @@ impl Arrows2DVisualizer { target: UiLabelTarget::Point2D(egui::pos2(midpoint.x, midpoint.y)), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }) } @@ -149,8 +150,10 @@ impl Arrows2DVisualizer { ) .picking_instance_id(PickingLayerInstanceId(i as _)); - if let Some(outline_mask_ids) = - ent_context.highlight.instances.get(&InstanceKey(i as _)) + if let Some(outline_mask_ids) = ent_context + .highlight + .instances + .get(&Instance::from(i as u64)) { segment.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/arrows3d.rs b/crates/re_space_view_spatial/src/visualizers/arrows3d.rs index a8244a48704bb..6cf8c8efe7b61 100644 --- a/crates/re_space_view_spatial/src/visualizers/arrows3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/arrows3d.rs @@ -1,9 +1,10 @@ use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x6; use re_renderer::{renderer::LineStripFlags, LineDrawableBuilder, PickingLayerInstanceId}; use re_types::{ archetypes::Arrows3D, - components::{ClassId, Color, InstanceKey, KeypointId, Position3D, Radius, Text, Vector3D}, + components::{ClassId, Color, KeypointId, Position3D, Radius, Text, Vector3D}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -73,7 +74,7 @@ impl Arrows3DVisualizer { ), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }) } @@ -152,8 +153,10 @@ impl Arrows3DVisualizer { ) .picking_instance_id(PickingLayerInstanceId(i as _)); - if let Some(outline_mask_ids) = - ent_context.highlight.instances.get(&InstanceKey(i as _)) + if let Some(outline_mask_ids) = ent_context + .highlight + .instances + .get(&Instance::from(i as u64)) { segment.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/assets3d.rs b/crates/re_space_view_spatial/src/visualizers/assets3d.rs index 8b263b246593d..dc0a636e67a66 100644 --- a/crates/re_space_view_spatial/src/visualizers/assets3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/assets3d.rs @@ -1,10 +1,10 @@ use re_entity_db::EntityPath; -use re_log_types::{RowId, TimeInt}; +use re_log_types::{Instance, RowId, TimeInt}; use re_query::range_zip_1x2; use re_renderer::renderer::MeshInstance; use re_types::{ archetypes::Asset3D, - components::{Blob, InstanceKey, MediaType, OutOfTreeTransform3D}, + components::{Blob, MediaType, OutOfTreeTransform3D}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContextCollection, @@ -59,8 +59,8 @@ impl Asset3DVisualizer { }; let primary_row_id = data.index.1; - let picking_instance_hash = re_entity_db::InstancePathHash::entity_splat(entity_path); - let outline_mask_ids = ent_context.highlight.index_outline_mask(InstanceKey::SPLAT); + let picking_instance_hash = re_entity_db::InstancePathHash::entity_all(entity_path); + let outline_mask_ids = ent_context.highlight.index_outline_mask(Instance::ALL); // TODO(#3232): this is subtly wrong, the key should actually be a hash of everything that got // cached, which includes the media type… diff --git a/crates/re_space_view_spatial/src/visualizers/boxes2d.rs b/crates/re_space_view_spatial/src/visualizers/boxes2d.rs index 13e5310da0d71..ab3c11bafc73b 100644 --- a/crates/re_space_view_spatial/src/visualizers/boxes2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/boxes2d.rs @@ -1,9 +1,10 @@ use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x6; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId}; use re_types::{ archetypes::Boxes2D, - components::{ClassId, Color, HalfSizes2D, InstanceKey, KeypointId, Position2D, Radius, Text}, + components::{ClassId, Color, HalfSizes2D, KeypointId, Position2D, Radius, Text}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -71,7 +72,7 @@ impl Boxes2DVisualizer { )), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }) } @@ -148,8 +149,10 @@ impl Boxes2DVisualizer { .color(color) .radius(radius) .picking_instance_id(PickingLayerInstanceId(i as _)); - if let Some(outline_mask_ids) = - ent_context.highlight.instances.get(&InstanceKey(i as _)) + if let Some(outline_mask_ids) = ent_context + .highlight + .instances + .get(&Instance::from(i as u64)) { rectangle.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/boxes3d.rs b/crates/re_space_view_spatial/src/visualizers/boxes3d.rs index 01eafdd87bd30..d2706fc2a0e76 100644 --- a/crates/re_space_view_spatial/src/visualizers/boxes3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/boxes3d.rs @@ -1,11 +1,10 @@ use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x7; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId}; use re_types::{ archetypes::Boxes3D, - components::{ - ClassId, Color, HalfSizes3D, InstanceKey, KeypointId, Position3D, Radius, Rotation3D, Text, - }, + components::{ClassId, Color, HalfSizes3D, KeypointId, Position3D, Radius, Rotation3D, Text}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -61,7 +60,10 @@ impl Boxes3DVisualizer { target: UiLabelTarget::Position3D( world_from_entity.transform_point3(center.0.into()), ), - labeled_instance: InstancePathHash::instance(entity_path, InstanceKey(i as _)), + labeled_instance: InstancePathHash::instance( + entity_path, + Instance::from(i as u64), + ), }) }) } @@ -137,8 +139,10 @@ impl Boxes3DVisualizer { .radius(radius) .picking_instance_id(PickingLayerInstanceId(i as _)); - if let Some(outline_mask_ids) = - ent_context.highlight.instances.get(&InstanceKey(i as _)) + if let Some(outline_mask_ids) = ent_context + .highlight + .instances + .get(&Instance::from(i as u64)) { box3d.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/cameras.rs b/crates/re_space_view_spatial/src/visualizers/cameras.rs index 737c384a3d64f..054993d8c5c12 100644 --- a/crates/re_space_view_spatial/src/visualizers/cameras.rs +++ b/crates/re_space_view_spatial/src/visualizers/cameras.rs @@ -1,9 +1,10 @@ use glam::vec3; use re_entity_db::{EntityPath, EntityProperties}; +use re_log_types::Instance; use re_renderer::renderer::LineStripFlags; use re_types::{ archetypes::Pinhole, - components::{InstanceKey, Transform3D, ViewCoordinates}, + components::{Transform3D, ViewCoordinates}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, SpaceViewOutlineMasks, SpaceViewSystemExecutionError, @@ -55,7 +56,7 @@ impl CamerasVisualizer { pinhole_view_coordinates: ViewCoordinates, entity_highlight: &SpaceViewOutlineMasks, ) { - let instance_key = InstanceKey(0); + let instance = Instance::from(0); let frustum_length = *props.pinhole_image_plane_distance; @@ -152,7 +153,7 @@ impl CamerasVisualizer { let radius = re_renderer::Size::new_points(1.0); let instance_path_for_picking = - re_entity_db::InstancePathHash::instance(ent_path, instance_key); + re_entity_db::InstancePathHash::instance(ent_path, instance); let instance_layer_id = picking_layer_id_from_instance_path_hash(instance_path_for_picking); let mut batch = line_builder @@ -172,7 +173,7 @@ impl CamerasVisualizer { .flags(LineStripFlags::FLAG_CAP_END_ROUND | LineStripFlags::FLAG_CAP_START_ROUND) .picking_instance_id(instance_layer_id.instance); - if let Some(outline_mask_ids) = entity_highlight.instances.get(&instance_key) { + if let Some(outline_mask_ids) = entity_highlight.instances.get(&instance) { lines.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/lines2d.rs b/crates/re_space_view_spatial/src/visualizers/lines2d.rs index b0af9ca8a81a7..d8b406fa80df9 100644 --- a/crates/re_space_view_spatial/src/visualizers/lines2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/lines2d.rs @@ -1,9 +1,10 @@ use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x5; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId}; use re_types::{ archetypes::LineStrips2D, - components::{ClassId, Color, InstanceKey, KeypointId, LineStrip2D, Radius, Text}, + components::{ClassId, Color, KeypointId, LineStrip2D, Radius, Text}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -71,7 +72,7 @@ impl Lines2DVisualizer { target: UiLabelTarget::Point2D(egui::pos2(midpoint.x, midpoint.y)), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }) } @@ -134,8 +135,10 @@ impl Lines2DVisualizer { .radius(radius) .picking_instance_id(PickingLayerInstanceId(i as _)); - if let Some(outline_mask_ids) = - ent_context.highlight.instances.get(&InstanceKey(i as _)) + if let Some(outline_mask_ids) = ent_context + .highlight + .instances + .get(&Instance::from(i as u64)) { lines.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/lines3d.rs b/crates/re_space_view_spatial/src/visualizers/lines3d.rs index 650f9278f8d3e..bce5b322444a8 100644 --- a/crates/re_space_view_spatial/src/visualizers/lines3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/lines3d.rs @@ -1,9 +1,10 @@ use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x5; use re_renderer::PickingLayerInstanceId; use re_types::{ archetypes::LineStrips3D, - components::{ClassId, Color, InstanceKey, KeypointId, LineStrip3D, Radius, Text}, + components::{ClassId, Color, KeypointId, LineStrip3D, Radius, Text}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -74,7 +75,7 @@ impl Lines3DVisualizer { ), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }) } @@ -140,8 +141,10 @@ impl Lines3DVisualizer { .radius(radius) .picking_instance_id(PickingLayerInstanceId(i as _)); - if let Some(outline_mask_ids) = - ent_context.highlight.instances.get(&InstanceKey(i as _)) + if let Some(outline_mask_ids) = ent_context + .highlight + .instances + .get(&Instance::from(i as u64)) { lines.outline_mask_ids(*outline_mask_ids); } diff --git a/crates/re_space_view_spatial/src/visualizers/meshes.rs b/crates/re_space_view_spatial/src/visualizers/meshes.rs index e2f33a489ee9e..bc1feb3b6a2c8 100644 --- a/crates/re_space_view_spatial/src/visualizers/meshes.rs +++ b/crates/re_space_view_spatial/src/visualizers/meshes.rs @@ -1,13 +1,12 @@ use itertools::Itertools as _; use re_entity_db::EntityPath; -use re_log_types::{RowId, TimeInt}; +use re_log_types::{Instance, RowId, TimeInt}; use re_query::range_zip_1x7; use re_renderer::renderer::MeshInstance; use re_types::{ archetypes::Mesh3D, components::{ - ClassId, Color, InstanceKey, Material, MeshProperties, Position3D, TensorData, Texcoord2D, - Vector3D, + ClassId, Color, Material, MeshProperties, Position3D, TensorData, Texcoord2D, Vector3D, }, }; use re_viewer_context::{ @@ -65,8 +64,8 @@ impl Mesh3DVisualizer { ) { for data in data { let primary_row_id = data.index.1; - let picking_instance_hash = re_entity_db::InstancePathHash::entity_splat(entity_path); - let outline_mask_ids = ent_context.highlight.index_outline_mask(InstanceKey::SPLAT); + let picking_instance_hash = re_entity_db::InstancePathHash::entity_all(entity_path); + let outline_mask_ids = ent_context.highlight.index_outline_mask(Instance::ALL); let mesh = ctx.cache.entry(|c: &mut MeshCache| { let key = MeshCacheKey { diff --git a/crates/re_space_view_spatial/src/visualizers/mod.rs b/crates/re_space_view_spatial/src/visualizers/mod.rs index a95147ef64723..f065933ad48e2 100644 --- a/crates/re_space_view_spatial/src/visualizers/mod.rs +++ b/crates/re_space_view_spatial/src/visualizers/mod.rs @@ -30,7 +30,7 @@ use ahash::HashMap; use re_entity_db::{EntityPath, InstancePathHash}; use re_types::{ - components::{Color, InstanceKey}, + components::Color, datatypes::{KeypointId, KeypointPair}, }; use re_viewer_context::{ @@ -345,7 +345,9 @@ pub fn load_keypoint_connections( .color(color) .flags(re_renderer::renderer::LineStripFlags::FLAG_COLOR_GRADIENT) // Select the entire object when clicking any of the lines. - .picking_instance_id(re_renderer::PickingLayerInstanceId(InstanceKey::SPLAT.0)); + .picking_instance_id(re_renderer::PickingLayerInstanceId( + re_log_types::Instance::ALL.get(), + )); } } diff --git a/crates/re_space_view_spatial/src/visualizers/points2d.rs b/crates/re_space_view_spatial/src/visualizers/points2d.rs index accc138faf776..d27ecee0f929b 100644 --- a/crates/re_space_view_spatial/src/visualizers/points2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/points2d.rs @@ -1,11 +1,12 @@ use itertools::Itertools as _; use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x5; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId, PointCloudBuilder}; use re_types::{ archetypes::Points2D, - components::{ClassId, Color, InstanceKey, KeypointId, Position2D, Radius, Text}, + components::{ClassId, Color, KeypointId, Position2D, Radius, Text}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -66,7 +67,7 @@ impl Points2DVisualizer { target: UiLabelTarget::Point2D(egui::pos2(point.x, point.y)), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }), _ => None, @@ -128,8 +129,9 @@ impl Points2DVisualizer { { re_tracing::profile_scope!("marking additional highlight points"); for (highlighted_key, instance_mask_ids) in &ent_context.highlight.instances { - let highlighted_point_index = - (highlighted_key.0 < num_instances as u64).then_some(highlighted_key.0); + let highlighted_point_index = (highlighted_key.get() + < num_instances as u64) + .then_some(highlighted_key.get()); if let Some(highlighted_point_index) = highlighted_point_index { point_range_builder = point_range_builder .push_additional_outline_mask_ids_for_range( diff --git a/crates/re_space_view_spatial/src/visualizers/points3d.rs b/crates/re_space_view_spatial/src/visualizers/points3d.rs index d4c9789e64387..d42ecdd771c58 100644 --- a/crates/re_space_view_spatial/src/visualizers/points3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/points3d.rs @@ -1,11 +1,12 @@ use itertools::Itertools as _; use re_entity_db::{EntityPath, InstancePathHash}; +use re_log_types::Instance; use re_query::range_zip_1x5; use re_renderer::{LineDrawableBuilder, PickingLayerInstanceId, PointCloudBuilder}; use re_types::{ archetypes::Points3D, - components::{ClassId, Color, InstanceKey, KeypointId, Position3D, Radius, Text}, + components::{ClassId, Color, KeypointId, Position3D, Radius, Text}, }; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, ResolvedAnnotationInfos, @@ -79,7 +80,7 @@ impl Points3DVisualizer { target: UiLabelTarget::Position3D(world_from_obj.transform_point3(*point)), labeled_instance: InstancePathHash::instance( entity_path, - InstanceKey(i as _), + Instance::from(i as u64), ), }), _ => None, @@ -133,8 +134,9 @@ impl Points3DVisualizer { // Determine if there's any sub-ranges that need extra highlighting. { for (highlighted_key, instance_mask_ids) in &ent_context.highlight.instances { - let highlighted_point_index = - (highlighted_key.0 < num_instances as u64).then_some(highlighted_key.0); + let highlighted_point_index = (highlighted_key.get() + < num_instances as u64) + .then_some(highlighted_key.get()); if let Some(highlighted_point_index) = highlighted_point_index { point_range_builder = point_range_builder .push_additional_outline_mask_ids_for_range( diff --git a/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs b/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs index 74b8dca7f9dfa..c9efd4216dc50 100644 --- a/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs +++ b/crates/re_space_view_spatial/src/visualizers/transform3d_arrows.rs @@ -1,6 +1,6 @@ use egui::Color32; -use re_log_types::EntityPath; -use re_types::components::{InstanceKey, Transform3D}; +use re_log_types::{EntityPath, Instance}; +use re_types::components::Transform3D; use re_viewer_context::{ ApplicableEntities, IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContextCollection, ViewQuery, ViewerContext, VisualizableEntities, VisualizableFilterContext, VisualizerQueryInfo, @@ -137,7 +137,7 @@ pub fn add_axis_arrows( .picking_object_id(re_renderer::PickingLayerObjectId( ent_path.map_or(0, |p| p.hash64()), )); - let picking_instance_id = re_renderer::PickingLayerInstanceId(InstanceKey::SPLAT.0); + let picking_instance_id = re_renderer::PickingLayerInstanceId(Instance::ALL.get()); line_batch .add_segment(glam::Vec3::ZERO, glam::Vec3::X * axis_length) diff --git a/crates/re_time_panel/src/data_density_graph.rs b/crates/re_time_panel/src/data_density_graph.rs index 3a73e4c1c224e..5d29c4b27e22c 100644 --- a/crates/re_time_panel/src/data_density_graph.rs +++ b/crates/re_time_panel/src/data_density_graph.rs @@ -563,7 +563,7 @@ fn show_row_ids_tooltip( ui.add_space(8.0); component_path.data_ui(ctx, ui, verbosity, &query, db); } else { - let instance_path = re_entity_db::InstancePath::entity_splat(entity_path.clone()); + let instance_path = re_entity_db::InstancePath::entity_all(entity_path.clone()); item_ui::instance_path_button(ctx, &query, db, ui, None, &instance_path); ui.add_space(8.0); instance_path.data_ui(ctx, ui, verbosity, &query, db); diff --git a/crates/re_time_panel/src/lib.rs b/crates/re_time_panel/src/lib.rs index 6aea8b62c4133..75b1303cfffbe 100644 --- a/crates/re_time_panel/src/lib.rs +++ b/crates/re_time_panel/src/lib.rs @@ -63,7 +63,7 @@ impl TimePanelItem { if let Some(component_name) = component_name { Item::ComponentPath(ComponentPath::new(entity_path.clone(), *component_name)) } else { - Item::InstancePath(InstancePath::entity_splat(entity_path.clone())) + Item::InstancePath(InstancePath::entity_all(entity_path.clone())) } } } diff --git a/crates/re_types/src/archetypes/annotation_context.rs b/crates/re_types/src/archetypes/annotation_context.rs index 1c481e7b9d8db..b9fa8ad82e3a1 100644 --- a/crates/re_types/src/archetypes/annotation_context.rs +++ b/crates/re_types/src/archetypes/annotation_context.rs @@ -97,20 +97,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.AnnotationContextIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.AnnotationContext".into(), "rerun.components.AnnotationContextIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl AnnotationContext { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`AnnotationContext`] [`::re_types_core::Archetype`] @@ -189,11 +188,6 @@ impl ::re_types_core::AsComponents for AnnotationContext { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl AnnotationContext { diff --git a/crates/re_types/src/archetypes/arrows2d.rs b/crates/re_types/src/archetypes/arrows2d.rs index 7065a69feaf35..8097432518ad7 100644 --- a/crates/re_types/src/archetypes/arrows2d.rs +++ b/crates/re_types/src/archetypes/arrows2d.rs @@ -113,18 +113,17 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Vector2D".into(), @@ -132,14 +131,13 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = "rerun.components.Position2D".into(), "rerun.components.ClassId".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); impl Arrows2D { - pub const NUM_COMPONENTS: usize = 8usize; + pub const NUM_COMPONENTS: usize = 7usize; } /// Indicator component for the [`Arrows2D`] [`::re_types_core::Archetype`] @@ -299,11 +297,6 @@ impl ::re_types_core::AsComponents for Arrows2D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.vectors.len() - } } impl Arrows2D { diff --git a/crates/re_types/src/archetypes/arrows3d.rs b/crates/re_types/src/archetypes/arrows3d.rs index 7799d3e88c235..f3e237d8770a5 100644 --- a/crates/re_types/src/archetypes/arrows3d.rs +++ b/crates/re_types/src/archetypes/arrows3d.rs @@ -126,18 +126,17 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Vector3D".into(), @@ -145,14 +144,13 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = "rerun.components.Position3D".into(), "rerun.components.ClassId".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); impl Arrows3D { - pub const NUM_COMPONENTS: usize = 8usize; + pub const NUM_COMPONENTS: usize = 7usize; } /// Indicator component for the [`Arrows3D`] [`::re_types_core::Archetype`] @@ -312,11 +310,6 @@ impl ::re_types_core::AsComponents for Arrows3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.vectors.len() - } } impl Arrows3D { diff --git a/crates/re_types/src/archetypes/asset3d.rs b/crates/re_types/src/archetypes/asset3d.rs index aa63c3e86ebe1..2a2ee20afaf7f 100644 --- a/crates/re_types/src/archetypes/asset3d.rs +++ b/crates/re_types/src/archetypes/asset3d.rs @@ -105,27 +105,21 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.InstanceKey".into(), - "rerun.components.OutOfTreeTransform3D".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.OutOfTreeTransform3D".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Blob".into(), "rerun.components.Asset3DIndicator".into(), "rerun.components.MediaType".into(), - "rerun.components.InstanceKey".into(), "rerun.components.OutOfTreeTransform3D".into(), ] }); impl Asset3D { - pub const NUM_COMPONENTS: usize = 5usize; + pub const NUM_COMPONENTS: usize = 4usize; } /// Indicator component for the [`Asset3D`] [`::re_types_core::Archetype`] @@ -233,11 +227,6 @@ impl ::re_types_core::AsComponents for Asset3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Asset3D { diff --git a/crates/re_types/src/archetypes/bar_chart.rs b/crates/re_types/src/archetypes/bar_chart.rs index f14cdedd95596..776000dd3ccc8 100644 --- a/crates/re_types/src/archetypes/bar_chart.rs +++ b/crates/re_types/src/archetypes/bar_chart.rs @@ -77,26 +77,20 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.BarChartIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.Color".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.TensorData".into(), "rerun.components.BarChartIndicator".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), ] }); impl BarChart { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`BarChart`] [`::re_types_core::Archetype`] @@ -187,11 +181,6 @@ impl ::re_types_core::AsComponents for BarChart { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl BarChart { diff --git a/crates/re_types/src/archetypes/boxes2d.rs b/crates/re_types/src/archetypes/boxes2d.rs index b444e86e40008..157edaad7e6f7 100644 --- a/crates/re_types/src/archetypes/boxes2d.rs +++ b/crates/re_types/src/archetypes/boxes2d.rs @@ -117,18 +117,17 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.HalfSizes2D".into(), @@ -137,14 +136,13 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = "rerun.components.Position2D".into(), "rerun.components.ClassId".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); impl Boxes2D { - pub const NUM_COMPONENTS: usize = 9usize; + pub const NUM_COMPONENTS: usize = 8usize; } /// Indicator component for the [`Boxes2D`] [`::re_types_core::Archetype`] @@ -317,11 +315,6 @@ impl ::re_types_core::AsComponents for Boxes2D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.half_sizes.len() - } } impl Boxes2D { diff --git a/crates/re_types/src/archetypes/boxes3d.rs b/crates/re_types/src/archetypes/boxes3d.rs index 40706069a2342..45b6063b0c4d4 100644 --- a/crates/re_types/src/archetypes/boxes3d.rs +++ b/crates/re_types/src/archetypes/boxes3d.rs @@ -124,17 +124,16 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.HalfSizes3D".into(), @@ -143,14 +142,13 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = "rerun.components.Position3D".into(), "rerun.components.Rotation3D".into(), "rerun.components.ClassId".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Radius".into(), "rerun.components.Text".into(), ] }); impl Boxes3D { - pub const NUM_COMPONENTS: usize = 9usize; + pub const NUM_COMPONENTS: usize = 8usize; } /// Indicator component for the [`Boxes3D`] [`::re_types_core::Archetype`] @@ -326,11 +324,6 @@ impl ::re_types_core::AsComponents for Boxes3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.half_sizes.len() - } } impl Boxes3D { diff --git a/crates/re_types/src/archetypes/depth_image.rs b/crates/re_types/src/archetypes/depth_image.rs index c9da537a2763c..4ba9444b8c1f1 100644 --- a/crates/re_types/src/archetypes/depth_image.rs +++ b/crates/re_types/src/archetypes/depth_image.rs @@ -104,28 +104,26 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.DepthImageIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.DepthMeter".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.TensorData".into(), "rerun.components.DepthImageIndicator".into(), "rerun.components.DepthMeter".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), ] }); impl DepthImage { - pub const NUM_COMPONENTS: usize = 5usize; + pub const NUM_COMPONENTS: usize = 4usize; } /// Indicator component for the [`DepthImage`] [`::re_types_core::Archetype`] @@ -232,11 +230,6 @@ impl ::re_types_core::AsComponents for DepthImage { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl DepthImage { diff --git a/crates/re_types/src/archetypes/disconnected_space.rs b/crates/re_types/src/archetypes/disconnected_space.rs index 8412af71c0a6f..4b79caf832ef5 100644 --- a/crates/re_types/src/archetypes/disconnected_space.rs +++ b/crates/re_types/src/archetypes/disconnected_space.rs @@ -88,20 +88,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.DisconnectedSpaceIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.DisconnectedSpace".into(), "rerun.components.DisconnectedSpaceIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl DisconnectedSpace { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`DisconnectedSpace`] [`::re_types_core::Archetype`] @@ -180,11 +179,6 @@ impl ::re_types_core::AsComponents for DisconnectedSpace { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl DisconnectedSpace { diff --git a/crates/re_types/src/archetypes/image.rs b/crates/re_types/src/archetypes/image.rs index 2a9c32f743ede..b3636b125a519 100644 --- a/crates/re_types/src/archetypes/image.rs +++ b/crates/re_types/src/archetypes/image.rs @@ -98,26 +98,20 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.ImageIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.DrawOrder".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.TensorData".into(), "rerun.components.ImageIndicator".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), ] }); impl Image { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`Image`] [`::re_types_core::Archetype`] @@ -208,11 +202,6 @@ impl ::re_types_core::AsComponents for Image { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Image { diff --git a/crates/re_types/src/archetypes/line_strips2d.rs b/crates/re_types/src/archetypes/line_strips2d.rs index 6b0e10344662b..5f99edf23ccf9 100644 --- a/crates/re_types/src/archetypes/line_strips2d.rs +++ b/crates/re_types/src/archetypes/line_strips2d.rs @@ -119,17 +119,16 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.LineStrip2D".into(), @@ -138,13 +137,12 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = "rerun.components.Radius".into(), "rerun.components.ClassId".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Text".into(), ] }); impl LineStrips2D { - pub const NUM_COMPONENTS: usize = 8usize; + pub const NUM_COMPONENTS: usize = 7usize; } /// Indicator component for the [`LineStrips2D`] [`::re_types_core::Archetype`] @@ -301,11 +299,6 @@ impl ::re_types_core::AsComponents for LineStrips2D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.strips.len() - } } impl LineStrips2D { diff --git a/crates/re_types/src/archetypes/line_strips3d.rs b/crates/re_types/src/archetypes/line_strips3d.rs index cdbe1529d700f..4cce5d41f8b9d 100644 --- a/crates/re_types/src/archetypes/line_strips3d.rs +++ b/crates/re_types/src/archetypes/line_strips3d.rs @@ -114,16 +114,15 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.LineStrip3D".into(), @@ -131,13 +130,12 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = "rerun.components.LineStrips3DIndicator".into(), "rerun.components.Radius".into(), "rerun.components.ClassId".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Text".into(), ] }); impl LineStrips3D { - pub const NUM_COMPONENTS: usize = 7usize; + pub const NUM_COMPONENTS: usize = 6usize; } /// Indicator component for the [`LineStrips3D`] [`::re_types_core::Archetype`] @@ -281,11 +279,6 @@ impl ::re_types_core::AsComponents for LineStrips3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.strips.len() - } } impl LineStrips3D { diff --git a/crates/re_types/src/archetypes/mesh3d.rs b/crates/re_types/src/archetypes/mesh3d.rs index 9fe29ce5f58ea..a5d8883f3ad39 100644 --- a/crates/re_types/src/archetypes/mesh3d.rs +++ b/crates/re_types/src/archetypes/mesh3d.rs @@ -128,19 +128,18 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Material".into(), "rerun.components.TensorData".into(), "rerun.components.Texcoord2D".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Position3D".into(), @@ -149,7 +148,6 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = "rerun.components.Vector3D".into(), "rerun.components.ClassId".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Material".into(), "rerun.components.TensorData".into(), "rerun.components.Texcoord2D".into(), @@ -157,7 +155,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = }); impl Mesh3D { - pub const NUM_COMPONENTS: usize = 10usize; + pub const NUM_COMPONENTS: usize = 9usize; } /// Indicator component for the [`Mesh3D`] [`::re_types_core::Archetype`] @@ -343,11 +341,6 @@ impl ::re_types_core::AsComponents for Mesh3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.vertex_positions.len() - } } impl Mesh3D { diff --git a/crates/re_types/src/archetypes/pinhole.rs b/crates/re_types/src/archetypes/pinhole.rs index 8bb93e7ffc51f..bc41635831a92 100644 --- a/crates/re_types/src/archetypes/pinhole.rs +++ b/crates/re_types/src/archetypes/pinhole.rs @@ -157,27 +157,21 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.InstanceKey".into(), - "rerun.components.ViewCoordinates".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.ViewCoordinates".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.PinholeProjection".into(), "rerun.components.PinholeIndicator".into(), "rerun.components.Resolution".into(), - "rerun.components.InstanceKey".into(), "rerun.components.ViewCoordinates".into(), ] }); impl Pinhole { - pub const NUM_COMPONENTS: usize = 5usize; + pub const NUM_COMPONENTS: usize = 4usize; } /// Indicator component for the [`Pinhole`] [`::re_types_core::Archetype`] @@ -285,11 +279,6 @@ impl ::re_types_core::AsComponents for Pinhole { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Pinhole { diff --git a/crates/re_types/src/archetypes/points2d.rs b/crates/re_types/src/archetypes/points2d.rs index 0f57878f93433..5c90d8f768003 100644 --- a/crates/re_types/src/archetypes/points2d.rs +++ b/crates/re_types/src/archetypes/points2d.rs @@ -129,18 +129,17 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), "rerun.components.KeypointId".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Position2D".into(), @@ -149,14 +148,13 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = "rerun.components.Radius".into(), "rerun.components.ClassId".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), "rerun.components.KeypointId".into(), "rerun.components.Text".into(), ] }); impl Points2D { - pub const NUM_COMPONENTS: usize = 9usize; + pub const NUM_COMPONENTS: usize = 8usize; } /// Indicator component for the [`Points2D`] [`::re_types_core::Archetype`] @@ -329,11 +327,6 @@ impl ::re_types_core::AsComponents for Points2D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.positions.len() - } } impl Points2D { diff --git a/crates/re_types/src/archetypes/points3d.rs b/crates/re_types/src/archetypes/points3d.rs index 8c88d53e4ccb6..618591340e95c 100644 --- a/crates/re_types/src/archetypes/points3d.rs +++ b/crates/re_types/src/archetypes/points3d.rs @@ -121,17 +121,16 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClassId".into(), - "rerun.components.InstanceKey".into(), "rerun.components.KeypointId".into(), "rerun.components.Text".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Position3D".into(), @@ -139,14 +138,13 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = "rerun.components.Points3DIndicator".into(), "rerun.components.Radius".into(), "rerun.components.ClassId".into(), - "rerun.components.InstanceKey".into(), "rerun.components.KeypointId".into(), "rerun.components.Text".into(), ] }); impl Points3D { - pub const NUM_COMPONENTS: usize = 8usize; + pub const NUM_COMPONENTS: usize = 7usize; } /// Indicator component for the [`Points3D`] [`::re_types_core::Archetype`] @@ -306,11 +304,6 @@ impl ::re_types_core::AsComponents for Points3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.positions.len() - } } impl Points3D { diff --git a/crates/re_types/src/archetypes/scalar.rs b/crates/re_types/src/archetypes/scalar.rs index 8de3cd9d838b7..2e93e834c1fbb 100644 --- a/crates/re_types/src/archetypes/scalar.rs +++ b/crates/re_types/src/archetypes/scalar.rs @@ -83,20 +83,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.ScalarIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Scalar".into(), "rerun.components.ScalarIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl Scalar { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`Scalar`] [`::re_types_core::Archetype`] @@ -175,11 +174,6 @@ impl ::re_types_core::AsComponents for Scalar { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Scalar { diff --git a/crates/re_types/src/archetypes/segmentation_image.rs b/crates/re_types/src/archetypes/segmentation_image.rs index 189fdeaa4c598..1f8eceacd6a4d 100644 --- a/crates/re_types/src/archetypes/segmentation_image.rs +++ b/crates/re_types/src/archetypes/segmentation_image.rs @@ -102,26 +102,20 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.SegmentationImageIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.DrawOrder".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.TensorData".into(), "rerun.components.SegmentationImageIndicator".into(), "rerun.components.DrawOrder".into(), - "rerun.components.InstanceKey".into(), ] }); impl SegmentationImage { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`SegmentationImage`] [`::re_types_core::Archetype`] @@ -212,11 +206,6 @@ impl ::re_types_core::AsComponents for SegmentationImage { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl SegmentationImage { diff --git a/crates/re_types/src/archetypes/series_line.rs b/crates/re_types/src/archetypes/series_line.rs index be4b339aa3a2d..db54b4bebbdfd 100644 --- a/crates/re_types/src/archetypes/series_line.rs +++ b/crates/re_types/src/archetypes/series_line.rs @@ -109,29 +109,27 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.SeriesLineIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Name".into(), "rerun.components.StrokeWidth".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.SeriesLineIndicator".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Name".into(), "rerun.components.StrokeWidth".into(), ] }); impl SeriesLine { - pub const NUM_COMPONENTS: usize = 5usize; + pub const NUM_COMPONENTS: usize = 4usize; } /// Indicator component for the [`SeriesLine`] [`::re_types_core::Archetype`] @@ -232,11 +230,6 @@ impl ::re_types_core::AsComponents for SeriesLine { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl SeriesLine { diff --git a/crates/re_types/src/archetypes/series_point.rs b/crates/re_types/src/archetypes/series_point.rs index d38f3222ca708..d771aa7c4abe0 100644 --- a/crates/re_types/src/archetypes/series_point.rs +++ b/crates/re_types/src/archetypes/series_point.rs @@ -118,23 +118,21 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.SeriesPointIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.MarkerShape".into(), "rerun.components.MarkerSize".into(), "rerun.components.Name".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.SeriesPointIndicator".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), "rerun.components.MarkerShape".into(), "rerun.components.MarkerSize".into(), "rerun.components.Name".into(), @@ -142,7 +140,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = }); impl SeriesPoint { - pub const NUM_COMPONENTS: usize = 6usize; + pub const NUM_COMPONENTS: usize = 5usize; } /// Indicator component for the [`SeriesPoint`] [`::re_types_core::Archetype`] @@ -260,11 +258,6 @@ impl ::re_types_core::AsComponents for SeriesPoint { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl SeriesPoint { diff --git a/crates/re_types/src/archetypes/tensor.rs b/crates/re_types/src/archetypes/tensor.rs index e7e5c13b71a94..a31b81af425ea 100644 --- a/crates/re_types/src/archetypes/tensor.rs +++ b/crates/re_types/src/archetypes/tensor.rs @@ -76,20 +76,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.TensorIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.TensorData".into(), "rerun.components.TensorIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl Tensor { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`Tensor`] [`::re_types_core::Archetype`] @@ -168,11 +167,6 @@ impl ::re_types_core::AsComponents for Tensor { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Tensor { diff --git a/crates/re_types/src/archetypes/text_document.rs b/crates/re_types/src/archetypes/text_document.rs index c88c2d8c463ac..ef28c198bba71 100644 --- a/crates/re_types/src/archetypes/text_document.rs +++ b/crates/re_types/src/archetypes/text_document.rs @@ -125,26 +125,20 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.TextDocumentIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.InstanceKey".into(), - "rerun.components.MediaType".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.MediaType".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Text".into(), "rerun.components.TextDocumentIndicator".into(), - "rerun.components.InstanceKey".into(), "rerun.components.MediaType".into(), ] }); impl TextDocument { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`TextDocument`] [`::re_types_core::Archetype`] @@ -235,11 +229,6 @@ impl ::re_types_core::AsComponents for TextDocument { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl TextDocument { diff --git a/crates/re_types/src/archetypes/text_log.rs b/crates/re_types/src/archetypes/text_log.rs index 55807ef24b6c5..2363dded0b92c 100644 --- a/crates/re_types/src/archetypes/text_log.rs +++ b/crates/re_types/src/archetypes/text_log.rs @@ -101,27 +101,21 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = ] }); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.Color".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Text".into(), "rerun.components.TextLogIndicator".into(), "rerun.components.TextLogLevel".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), ] }); impl TextLog { - pub const NUM_COMPONENTS: usize = 5usize; + pub const NUM_COMPONENTS: usize = 4usize; } /// Indicator component for the [`TextLog`] [`::re_types_core::Archetype`] @@ -224,11 +218,6 @@ impl ::re_types_core::AsComponents for TextLog { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl TextLog { diff --git a/crates/re_types/src/archetypes/transform3d.rs b/crates/re_types/src/archetypes/transform3d.rs index 2cb6259e326f9..0be5132b90817 100644 --- a/crates/re_types/src/archetypes/transform3d.rs +++ b/crates/re_types/src/archetypes/transform3d.rs @@ -90,20 +90,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.Transform3DIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.Transform3D".into(), "rerun.components.Transform3DIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl Transform3D { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`Transform3D`] [`::re_types_core::Archetype`] @@ -182,11 +181,6 @@ impl ::re_types_core::AsComponents for Transform3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Transform3D { diff --git a/crates/re_types/src/archetypes/view_coordinates.rs b/crates/re_types/src/archetypes/view_coordinates.rs index a317d3d754ef3..83268138ec602 100644 --- a/crates/re_types/src/archetypes/view_coordinates.rs +++ b/crates/re_types/src/archetypes/view_coordinates.rs @@ -83,20 +83,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.ViewCoordinatesIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ViewCoordinates".into(), "rerun.components.ViewCoordinatesIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl ViewCoordinates { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`ViewCoordinates`] [`::re_types_core::Archetype`] @@ -175,11 +174,6 @@ impl ::re_types_core::AsComponents for ViewCoordinates { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl ViewCoordinates { diff --git a/crates/re_types/src/blueprint/archetypes/background3d.rs b/crates/re_types/src/blueprint/archetypes/background3d.rs index 944eb079de19b..d30c12ba4a906 100644 --- a/crates/re_types/src/blueprint/archetypes/background3d.rs +++ b/crates/re_types/src/blueprint/archetypes/background3d.rs @@ -53,26 +53,20 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.Background3DIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.components.Color".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.Background3DKind".into(), "rerun.blueprint.components.Background3DIndicator".into(), "rerun.components.Color".into(), - "rerun.components.InstanceKey".into(), ] }); impl Background3D { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`Background3D`] [`::re_types_core::Archetype`] @@ -163,11 +157,6 @@ impl ::re_types_core::AsComponents for Background3D { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Background3D { diff --git a/crates/re_types/src/blueprint/archetypes/plot_legend.rs b/crates/re_types/src/blueprint/archetypes/plot_legend.rs index 8f146378673d4..19d72afe8641e 100644 --- a/crates/re_types/src/blueprint/archetypes/plot_legend.rs +++ b/crates/re_types/src/blueprint/archetypes/plot_legend.rs @@ -55,27 +55,25 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.PlotLegendIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.Corner2D".into(), "rerun.blueprint.components.Visible".into(), - "rerun.components.InstanceKey".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.PlotLegendIndicator".into(), "rerun.blueprint.components.Corner2D".into(), "rerun.blueprint.components.Visible".into(), - "rerun.components.InstanceKey".into(), ] }); impl PlotLegend { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`PlotLegend`] [`::re_types_core::Archetype`] @@ -166,11 +164,6 @@ impl ::re_types_core::AsComponents for PlotLegend { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl PlotLegend { diff --git a/crates/re_types/src/blueprint/archetypes/scalar_axis.rs b/crates/re_types/src/blueprint/archetypes/scalar_axis.rs index 0c1660af0cd99..af7a36b6cae1a 100644 --- a/crates/re_types/src/blueprint/archetypes/scalar_axis.rs +++ b/crates/re_types/src/blueprint/archetypes/scalar_axis.rs @@ -53,27 +53,25 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ScalarAxisIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.LockRangeDuringZoom".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Range1D".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.ScalarAxisIndicator".into(), "rerun.blueprint.components.LockRangeDuringZoom".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Range1D".into(), ] }); impl ScalarAxis { - pub const NUM_COMPONENTS: usize = 4usize; + pub const NUM_COMPONENTS: usize = 3usize; } /// Indicator component for the [`ScalarAxis`] [`::re_types_core::Archetype`] @@ -167,11 +165,6 @@ impl ::re_types_core::AsComponents for ScalarAxis { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl ScalarAxis { diff --git a/crates/re_types/src/blueprint/archetypes/space_view_blueprint.rs b/crates/re_types/src/blueprint/archetypes/space_view_blueprint.rs index 0742019dcd6bd..7df38d6154755 100644 --- a/crates/re_types/src/blueprint/archetypes/space_view_blueprint.rs +++ b/crates/re_types/src/blueprint/archetypes/space_view_blueprint.rs @@ -72,30 +72,28 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = || ["rerun.blueprint.components.SpaceViewBlueprintIndicator".into()], ); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.SpaceViewOrigin".into(), "rerun.blueprint.components.Visible".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Name".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.SpaceViewClass".into(), "rerun.blueprint.components.SpaceViewBlueprintIndicator".into(), "rerun.blueprint.components.SpaceViewOrigin".into(), "rerun.blueprint.components.Visible".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Name".into(), ] }); impl SpaceViewBlueprint { - pub const NUM_COMPONENTS: usize = 6usize; + pub const NUM_COMPONENTS: usize = 5usize; } /// Indicator component for the [`SpaceViewBlueprint`] [`::re_types_core::Archetype`] @@ -218,11 +216,6 @@ impl ::re_types_core::AsComponents for SpaceViewBlueprint { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl SpaceViewBlueprint { diff --git a/crates/re_types/src/blueprint/archetypes/space_view_contents.rs b/crates/re_types/src/blueprint/archetypes/space_view_contents.rs index 549050ed0249e..97b59c85484b1 100644 --- a/crates/re_types/src/blueprint/archetypes/space_view_contents.rs +++ b/crates/re_types/src/blueprint/archetypes/space_view_contents.rs @@ -86,25 +86,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.SpaceViewContentsIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.QueryExpression".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.QueryExpression".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.SpaceViewContentsIndicator".into(), "rerun.blueprint.components.QueryExpression".into(), - "rerun.components.InstanceKey".into(), ] }); impl SpaceViewContents { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`SpaceViewContents`] [`::re_types_core::Archetype`] @@ -182,11 +176,6 @@ impl ::re_types_core::AsComponents for SpaceViewContents { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl SpaceViewContents { diff --git a/crates/re_types/src/datagen.rs b/crates/re_types/src/datagen.rs index 37239d93e51ee..d276d78837deb 100644 --- a/crates/re_types/src/datagen.rs +++ b/crates/re_types/src/datagen.rs @@ -2,8 +2,6 @@ // TODO(#1810): It really is time for whole module to disappear. -use crate::components::InstanceKey; - /// Create `len` dummy colors pub fn build_some_colors(len: usize) -> Vec { (0..len) @@ -38,26 +36,3 @@ pub fn build_some_vec3d(len: usize) -> Vec { }) .collect() } - -/// Create `len` dummy `InstanceKey` keys. These keys will be sorted. -pub fn build_some_instances(num_instances: usize) -> Vec { - use rand::seq::SliceRandom; - let mut rng = rand::thread_rng(); - - // Allocate pool of 10x the potential instance keys, draw a random sampling, and then sort it - let mut instance_pool = (0..(num_instances * 10)).collect::>(); - let (rand_instances, _) = instance_pool.partial_shuffle(&mut rng, num_instances); - let mut sorted_instances = rand_instances.to_vec(); - sorted_instances.sort(); - - sorted_instances - .into_iter() - .map(|id| InstanceKey(id as u64)) - .collect() -} - -pub fn build_some_instances_from(instances: impl IntoIterator) -> Vec { - let mut instances = instances.into_iter().map(InstanceKey).collect::>(); - instances.sort(); - instances -} diff --git a/crates/re_types/src/lib.rs b/crates/re_types/src/lib.rs index a826d99724e09..d86b654fc0410 100644 --- a/crates/re_types/src/lib.rs +++ b/crates/re_types/src/lib.rs @@ -184,10 +184,6 @@ pub const DISPLAY_PRECISION: usize = 3; /// For instance, the [`Points3D`][archetypes::Points3D] archetype contains a /// batch of positions, a batch of colors, etc. /// -/// These component batches are must all have the same length, or one of the special lengths: -/// * 0 - an empty batch -/// * 1 - a "splat" batch, e.g. using the same color for all positions. -/// /// Each entity can consist of many archetypes, but usually each entity will only have one archetype. /// /// A special archetype is [`Clear`][archetypes::Clear] which resets all the components @@ -214,9 +210,9 @@ pub mod archetypes { /// Each component is a wrapper around a [`datatype`][datatypes]. pub mod components { - // Some components (e.g. `InstanceKey`) are so fundamental and used everywhere that we want - // them to be exposed by `re_types_core` directly; that way we don't force a dependency on the - // `re_types` behemoth just so one can use one of these fundamental types. + // Some components are so fundamental and used everywhere that we want them to be exposed + // by `re_types_core` directly; that way we don't force a dependency on the `re_types` + // behemoth just so one can use one of these fundamental types. // // To do so, re-inject `re_types_core`'s components into our own module. @@ -232,9 +228,9 @@ pub mod components { /// They all implement the [`Datatype`] trait. pub mod datatypes { - // Some datatypes (e.g. `InstanceKey`) are so fundamental and used everywhere that we want - // them to be exposed by `re_types_core` directly; that way we don't force a dependency on the - // `re_types` behemoth just so one can use one of these fundamental types. + // Some datatypes are so fundamental and used everywhere that we want them to be exposed + // by `re_types_core` directly; that way we don't force a dependency on the `re_types` + // behemoth just so one can use one of these fundamental types. // // To do so, re-inject `re_types_core`'s datatypes into our own module. diff --git a/crates/re_types/src/testing/archetypes/affix_fuzzer1.rs b/crates/re_types/src/testing/archetypes/affix_fuzzer1.rs index 9668a060d3786..bfb7e49197930 100644 --- a/crates/re_types/src/testing/archetypes/affix_fuzzer1.rs +++ b/crates/re_types/src/testing/archetypes/affix_fuzzer1.rs @@ -133,10 +133,10 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 22usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer1Indicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 24usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 23usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.testing.components.AffixFuzzer1".into(), @@ -162,12 +162,11 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 24usize]> = "rerun.testing.components.AffixFuzzer8".into(), "rerun.testing.components.AffixFuzzer9".into(), "rerun.testing.components.AffixFuzzer1Indicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl AffixFuzzer1 { - pub const NUM_COMPONENTS: usize = 24usize; + pub const NUM_COMPONENTS: usize = 23usize; } /// Indicator component for the [`AffixFuzzer1`] [`::re_types_core::Archetype`] @@ -563,11 +562,6 @@ impl ::re_types_core::AsComponents for AffixFuzzer1 { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl AffixFuzzer1 { diff --git a/crates/re_types/src/testing/archetypes/affix_fuzzer2.rs b/crates/re_types/src/testing/archetypes/affix_fuzzer2.rs index f3e9f60038630..2585277f2fd0d 100644 --- a/crates/re_types/src/testing/archetypes/affix_fuzzer2.rs +++ b/crates/re_types/src/testing/archetypes/affix_fuzzer2.rs @@ -121,10 +121,10 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer2Indicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 21usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 20usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.testing.components.AffixFuzzer1".into(), @@ -147,12 +147,11 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 21usize]> = "rerun.testing.components.AffixFuzzer8".into(), "rerun.testing.components.AffixFuzzer9".into(), "rerun.testing.components.AffixFuzzer2Indicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl AffixFuzzer2 { - pub const NUM_COMPONENTS: usize = 21usize; + pub const NUM_COMPONENTS: usize = 20usize; } /// Indicator component for the [`AffixFuzzer2`] [`::re_types_core::Archetype`] @@ -484,11 +483,6 @@ impl ::re_types_core::AsComponents for AffixFuzzer2 { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - self.fuzz1101.len() - } } impl AffixFuzzer2 { diff --git a/crates/re_types/src/testing/archetypes/affix_fuzzer3.rs b/crates/re_types/src/testing/archetypes/affix_fuzzer3.rs index 34edf9f5ae406..9017b2b7cd086 100644 --- a/crates/re_types/src/testing/archetypes/affix_fuzzer3.rs +++ b/crates/re_types/src/testing/archetypes/affix_fuzzer3.rs @@ -96,10 +96,9 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer3Indicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 18usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.InstanceKey".into(), "rerun.testing.components.AffixFuzzer1".into(), "rerun.testing.components.AffixFuzzer10".into(), "rerun.testing.components.AffixFuzzer11".into(), @@ -121,11 +120,10 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 20usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.testing.components.AffixFuzzer3Indicator".into(), - "rerun.components.InstanceKey".into(), "rerun.testing.components.AffixFuzzer1".into(), "rerun.testing.components.AffixFuzzer10".into(), "rerun.testing.components.AffixFuzzer11".into(), @@ -148,7 +146,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 20usize]> = }); impl AffixFuzzer3 { - pub const NUM_COMPONENTS: usize = 20usize; + pub const NUM_COMPONENTS: usize = 19usize; } /// Indicator component for the [`AffixFuzzer3`] [`::re_types_core::Archetype`] @@ -466,11 +464,6 @@ impl ::re_types_core::AsComponents for AffixFuzzer3 { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl AffixFuzzer3 { diff --git a/crates/re_types/src/testing/archetypes/affix_fuzzer4.rs b/crates/re_types/src/testing/archetypes/affix_fuzzer4.rs index 76a85736b4a6d..e7707a3f3d44b 100644 --- a/crates/re_types/src/testing/archetypes/affix_fuzzer4.rs +++ b/crates/re_types/src/testing/archetypes/affix_fuzzer4.rs @@ -96,10 +96,9 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.testing.components.AffixFuzzer4Indicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 18usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.components.InstanceKey".into(), "rerun.testing.components.AffixFuzzer1".into(), "rerun.testing.components.AffixFuzzer10".into(), "rerun.testing.components.AffixFuzzer11".into(), @@ -121,11 +120,10 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 20usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 19usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.testing.components.AffixFuzzer4Indicator".into(), - "rerun.components.InstanceKey".into(), "rerun.testing.components.AffixFuzzer1".into(), "rerun.testing.components.AffixFuzzer10".into(), "rerun.testing.components.AffixFuzzer11".into(), @@ -148,7 +146,7 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 20usize]> = }); impl AffixFuzzer4 { - pub const NUM_COMPONENTS: usize = 20usize; + pub const NUM_COMPONENTS: usize = 19usize; } /// Indicator component for the [`AffixFuzzer4`] [`::re_types_core::Archetype`] @@ -520,11 +518,6 @@ impl ::re_types_core::AsComponents for AffixFuzzer4 { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl AffixFuzzer4 { diff --git a/crates/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs b/crates/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs index 92f5c99be9fc7..087805a6b078b 100644 --- a/crates/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs +++ b/crates/re_types_blueprint/src/blueprint/archetypes/container_blueprint.rs @@ -100,7 +100,7 @@ static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = || ["rerun.blueprint.components.ContainerBlueprintIndicator".into()], ); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.ActiveTab".into(), @@ -109,12 +109,11 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 8usize]> = "rerun.blueprint.components.IncludedContent".into(), "rerun.blueprint.components.RowShare".into(), "rerun.blueprint.components.Visible".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Name".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 9usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.ContainerKind".into(), @@ -125,13 +124,12 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 10usize]> = "rerun.blueprint.components.IncludedContent".into(), "rerun.blueprint.components.RowShare".into(), "rerun.blueprint.components.Visible".into(), - "rerun.components.InstanceKey".into(), "rerun.components.Name".into(), ] }); impl ContainerBlueprint { - pub const NUM_COMPONENTS: usize = 10usize; + pub const NUM_COMPONENTS: usize = 9usize; } /// Indicator component for the [`ContainerBlueprint`] [`::re_types_core::Archetype`] @@ -319,11 +317,6 @@ impl ::re_types_core::AsComponents for ContainerBlueprint { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl ContainerBlueprint { diff --git a/crates/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs b/crates/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs index 0de354498ec2a..c992d67206209 100644 --- a/crates/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs +++ b/crates/re_types_blueprint/src/blueprint/archetypes/panel_blueprint.rs @@ -47,25 +47,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.PanelBlueprintIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.PanelExpanded".into(), - "rerun.components.InstanceKey".into(), - ] - }); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = + once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.PanelExpanded".into()]); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.PanelBlueprintIndicator".into(), "rerun.blueprint.components.PanelExpanded".into(), - "rerun.components.InstanceKey".into(), ] }); impl PanelBlueprint { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`PanelBlueprint`] [`::re_types_core::Archetype`] @@ -143,11 +137,6 @@ impl ::re_types_core::AsComponents for PanelBlueprint { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl PanelBlueprint { diff --git a/crates/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs b/crates/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs index db96ae055c1d7..3cde4b26de057 100644 --- a/crates/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs +++ b/crates/re_types_blueprint/src/blueprint/archetypes/viewport_blueprint.rs @@ -80,7 +80,7 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.ViewportBlueprintIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.AutoLayout".into(), @@ -88,11 +88,10 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = "rerun.blueprint.components.RootContainer".into(), "rerun.blueprint.components.SpaceViewMaximized".into(), "rerun.blueprint.components.ViewerRecommendationHash".into(), - "rerun.components.InstanceKey".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.blueprint.components.ViewportBlueprintIndicator".into(), @@ -101,12 +100,11 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 7usize]> = "rerun.blueprint.components.RootContainer".into(), "rerun.blueprint.components.SpaceViewMaximized".into(), "rerun.blueprint.components.ViewerRecommendationHash".into(), - "rerun.components.InstanceKey".into(), ] }); impl ViewportBlueprint { - pub const NUM_COMPONENTS: usize = 7usize; + pub const NUM_COMPONENTS: usize = 6usize; } /// Indicator component for the [`ViewportBlueprint`] [`::re_types_core::Archetype`] @@ -251,11 +249,6 @@ impl ::re_types_core::AsComponents for ViewportBlueprint { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 0 - } } impl ViewportBlueprint { diff --git a/crates/re_types_builder/src/codegen/cpp/mod.rs b/crates/re_types_builder/src/codegen/cpp/mod.rs index de1e378d6364e..737ddb8e26ab0 100644 --- a/crates/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/re_types_builder/src/codegen/cpp/mod.rs @@ -516,33 +516,6 @@ impl QuotedObject { }); } - // Num instances gives the number of primary instances. - { - let first_required_field = required_component_fields.first(); - let definition_body = if let Some(field) = first_required_field { - let first_required_field_name = &format_ident!("{}", field.name); - if field.typ.is_plural() { - quote!(return #first_required_field_name.size();) - } else { - quote!(return 1;) - } - } else { - quote!(return 0;) - }; - methods.push(Method { - docs: "Returns the number of primary instances of this archetype.".into(), - declaration: MethodDeclaration { - is_static: false, - return_type: quote!(size_t), - name_and_parameters: quote! { - num_instances() const - }, - }, - definition_body, - inline: true, - }); - } - let quoted_namespace = if let Some(scope) = obj.scope() { let scope = format_ident!("{}", scope); quote! { #scope::archetypes } diff --git a/crates/re_types_builder/src/codegen/rust/api.rs b/crates/re_types_builder/src/codegen/rust/api.rs index 272229d45e1e4..1111b897d4560 100644 --- a/crates/re_types_builder/src/codegen/rust/api.rs +++ b/crates/re_types_builder/src/codegen/rust/api.rs @@ -1061,23 +1061,6 @@ fn quote_trait_impls_from_obj( (num_components, quoted_components) } - let first_required_comp = obj.fields.iter().find(|field| { - field - .try_get_attr::(ATTR_RERUN_COMPONENT_REQUIRED) - .is_some() - }); - - let num_instances = if let Some(comp) = first_required_comp { - if comp.typ.is_plural() { - let name = format_ident!("{}", comp.name); - quote!(self.#name.len()) - } else { - quote!(1) - } - } else { - quote!(0) - }; - let indicator_name = format!("{}Indicator", obj.name); let indicator_fqname = format!("{}Indicator", obj.fqname).replace("archetypes", "components"); @@ -1090,14 +1073,8 @@ fn quote_trait_impls_from_obj( compute_components(obj, ATTR_RERUN_COMPONENT_REQUIRED, []); let (num_recommended, recommended) = compute_components(obj, ATTR_RERUN_COMPONENT_RECOMMENDED, [indicator_fqname]); - let (num_optional, optional) = compute_components( - obj, - ATTR_RERUN_COMPONENT_OPTIONAL, - // NOTE: Our internal query systems always need to query for instance keys, and - // they need to do so using a compile-time array, so make sure it's there at - // compile-time even for archetypes that don't use it. - ["rerun.components.InstanceKey".to_owned()], - ); + let (num_optional, optional) = + compute_components(obj, ATTR_RERUN_COMPONENT_OPTIONAL, []); let num_all = num_required + num_recommended + num_optional; @@ -1299,11 +1276,6 @@ fn quote_trait_impls_from_obj( [#(#all_component_batches,)*].into_iter().flatten().collect() } - - #[inline] - fn num_instances(&self) -> usize { - #num_instances - } } } } diff --git a/crates/re_types_core/src/archetype.rs b/crates/re_types_core/src/archetype.rs index f34db737595a7..23c2337d9b0a4 100644 --- a/crates/re_types_core/src/archetype.rs +++ b/crates/re_types_core/src/archetype.rs @@ -25,7 +25,7 @@ pub trait Archetype { /// /// ## Internal representation /// - /// Indicator components are always-splatted null arrays. + /// Indicator components are always unit-length null arrays. /// Their names follow the pattern `rerun.components.{ArchetypeName}Indicator`, e.g. /// `rerun.components.Points3DIndicator`. /// diff --git a/crates/re_types_core/src/archetypes/clear.rs b/crates/re_types_core/src/archetypes/clear.rs index 0b458b85a5faf..da15c9b1b67f4 100644 --- a/crates/re_types_core/src/archetypes/clear.rs +++ b/crates/re_types_core/src/archetypes/clear.rs @@ -100,20 +100,19 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.components.ClearIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| ["rerun.components.InstanceKey".into()]); +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = + once_cell::sync::Lazy::new(|| []); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = once_cell::sync::Lazy::new(|| { [ "rerun.components.ClearIsRecursive".into(), "rerun.components.ClearIndicator".into(), - "rerun.components.InstanceKey".into(), ] }); impl Clear { - pub const NUM_COMPONENTS: usize = 3usize; + pub const NUM_COMPONENTS: usize = 2usize; } /// Indicator component for the [`Clear`] [`crate::Archetype`] @@ -192,11 +191,6 @@ impl crate::AsComponents for Clear { .flatten() .collect() } - - #[inline] - fn num_instances(&self) -> usize { - 1 - } } impl Clear { diff --git a/crates/re_types_core/src/lib.rs b/crates/re_types_core/src/lib.rs index e50b6ef053fe3..657d3eaa5cd7a 100644 --- a/crates/re_types_core/src/lib.rs +++ b/crates/re_types_core/src/lib.rs @@ -45,19 +45,6 @@ pub trait AsComponents { // depending on their presence (or lack thereof) at runtime anyway. fn as_component_batches(&self) -> Vec>; - /// The number of instances in each batch. - /// - /// If not implemented, the number of instances will be determined by the longest - /// batch in the bundle. - #[inline] - fn num_instances(&self) -> usize { - self.as_component_batches() - .into_iter() - .map(|comp_batch| comp_batch.as_ref().num_instances()) - .max() - .unwrap_or(0) - } - // --- /// Serializes all non-null [`Component`]s of this bundle into Arrow arrays. diff --git a/crates/re_ui/src/syntax_highlighting.rs b/crates/re_ui/src/syntax_highlighting.rs index 3e399234002c6..f2b97d0cd266d 100644 --- a/crates/re_ui/src/syntax_highlighting.rs +++ b/crates/re_ui/src/syntax_highlighting.rs @@ -1,5 +1,5 @@ use re_entity_db::InstancePath; -use re_log_types::{external::re_types_core::components::InstanceKey, EntityPath, EntityPathPart}; +use re_log_types::{EntityPath, EntityPathPart, Instance}; use egui::{text::LayoutJob, Color32, Style, TextFormat}; @@ -39,12 +39,12 @@ impl SyntaxHighlighting for EntityPathPart { } } -impl SyntaxHighlighting for InstanceKey { +impl SyntaxHighlighting for Instance { fn syntax_highlight_into(&self, style: &Style, job: &mut LayoutJob) { - if self.is_splat() { - job.append("splat", 0.0, text_format(style)); + if self.is_all() { + job.append("all", 0.0, text_format(style)); } else { - job.append(&re_format::format_uint(self.0), 0.0, text_format(style)); + job.append(&re_format::format_uint(self.get()), 0.0, text_format(style)); } } } @@ -65,9 +65,9 @@ impl SyntaxHighlighting for EntityPath { impl SyntaxHighlighting for InstancePath { fn syntax_highlight_into(&self, style: &Style, job: &mut LayoutJob) { self.entity_path.syntax_highlight_into(style, job); - if !self.instance_key.is_splat() { + if !self.instance.is_all() { job.append("[", 0.0, faint_text_format(style)); - self.instance_key.syntax_highlight_into(style, job); + self.instance.syntax_highlight_into(style, job); job.append("]", 0.0, faint_text_format(style)); } } diff --git a/crates/re_viewer/src/app_blueprint.rs b/crates/re_viewer/src/app_blueprint.rs index 987935a1640bd..2b8fbc75cf189 100644 --- a/crates/re_viewer/src/app_blueprint.rs +++ b/crates/re_viewer/src/app_blueprint.rs @@ -93,8 +93,8 @@ pub fn setup_welcome_screen_blueprint(welcome_screen_blueprint: &mut EntityDb) { let component = PanelExpanded(is_expanded.into()); - let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, [component]) - .unwrap(); // Can only fail if we have the wrong number of instances for the component, and we don't + let row = + DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, [component]).unwrap(); // Can only fail if we have the wrong number of instances for the component, and we don't welcome_screen_blueprint.add_data_row(row).unwrap(); // Can only fail if we have the wrong number of instances for the component, and we don't } @@ -116,9 +116,8 @@ impl<'a> AppBlueprint<'a> { let component = PanelExpanded(is_expanded.into()); - let row = - DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, 1, [component]) - .unwrap(); // Can only fail if we have the wrong number of instances for the component, and we don't + let row = DataRow::from_cells1_sized(RowId::new(), entity_path, timepoint, [component]) + .unwrap(); // Can only fail if we have the wrong number of instances for the component, and we don't command_sender.send_system(SystemCommand::UpdateBlueprint( store_ctx.blueprint.store_id().clone(), diff --git a/crates/re_viewer/src/ui/memory_panel.rs b/crates/re_viewer/src/ui/memory_panel.rs index e7a434e77cb05..9b896e97a98a7 100644 --- a/crates/re_viewer/src/ui/memory_panel.rs +++ b/crates/re_viewer/src/ui/memory_panel.rs @@ -249,7 +249,6 @@ impl MemoryPanel { let DataStoreStats { type_registry, metadata_registry, - autogenerated, static_tables, temporal, temporal_buckets, @@ -282,11 +281,6 @@ impl MemoryPanel { label_row_stats(ui, metadata_registry); ui.end_row(); - ui.label("Cluster cache:"); - ui.label(""); - label_row_stats(ui, autogenerated); - ui.end_row(); - ui.label("Static:"); ui.label(""); label_row_stats(ui, static_tables); diff --git a/crates/re_viewer/src/ui/override_ui.rs b/crates/re_viewer/src/ui/override_ui.rs index 6ff2c4b7b794c..8766fa7289e56 100644 --- a/crates/re_viewer/src/ui/override_ui.rs +++ b/crates/re_viewer/src/ui/override_ui.rs @@ -5,12 +5,9 @@ use itertools::Itertools; use re_data_store::LatestAtQuery; use re_data_ui::is_component_visible_in_ui; use re_entity_db::{EntityDb, InstancePath}; -use re_log_types::{DataCell, DataRow, RowId, StoreKind}; +use re_log_types::{DataRow, RowId, StoreKind}; use re_space_view::{determine_visualizable_entities, SpaceViewBlueprint}; -use re_types_core::{ - components::{InstanceKey, VisualizerOverrides}, - ComponentName, -}; +use re_types_core::{components::VisualizerOverrides, ComponentName}; use re_viewer_context::{ DataResult, OverridePath, SystemCommand, SystemCommandSender as _, UiVerbosity, ViewSystemIdentifier, ViewerContext, @@ -24,7 +21,7 @@ pub fn override_ui( ) { let InstancePath { entity_path, - instance_key, + instance, } = instance_path; // Because of how overrides are implemented the overridden-data must be an entity @@ -173,7 +170,7 @@ pub fn override_ui( path, &overrides.individual_override_path, &results, - instance_key, + instance, ); } else { // TODO(jleibs): Is it possible to set an override to empty and not confuse @@ -239,20 +236,10 @@ pub fn add_new_override( let components = [*component]; - let mut splat_cell: DataCell = [InstanceKey::SPLAT].into(); - splat_cell.compute_size_bytes(); - let Some(mut initial_data) = db .store() .latest_at(query, &data_result.entity_path, *component, &components) .and_then(|result| result.2[0].clone()) - .and_then(|cell| { - if cell.num_instances() == 1 { - Some(cell) - } else { - None - } - }) .or_else(|| { view_systems.get_by_identifier(*viz).ok().and_then(|sys| { sys.initial_override_value( @@ -284,8 +271,7 @@ pub fn add_new_override( RowId::new(), ctx.store_context.blueprint_timepoint_for_writes(), override_path.clone(), - 1, - [splat_cell, initial_data], + [initial_data], ) { Ok(row) => { ctx.command_sender @@ -325,7 +311,7 @@ pub fn override_visualizer_ui( ui.push_id("visualizer_overrides", |ui| { let InstancePath { entity_path, - instance_key: _, + instance: _, } = instance_path; let recording = ctx.recording(); diff --git a/crates/re_viewer/src/ui/selection_panel.rs b/crates/re_viewer/src/ui/selection_panel.rs index b311b38055bdd..9497fa08be553 100644 --- a/crates/re_viewer/src/ui/selection_panel.rs +++ b/crates/re_viewer/src/ui/selection_panel.rs @@ -425,7 +425,7 @@ fn what_is_selected_ui( &format!("{typ} '{instance_path}'"), ); - let is_instance = !instance_path.instance_key.is_splat(); + let is_instance = !instance_path.instance.is_all(); let parent = if is_instance { Some(instance_path.entity_path.clone()) } else { @@ -461,7 +461,7 @@ fn what_is_selected_ui( ), ); - let is_instance = !instance_path.instance_key.is_splat(); + let is_instance = !instance_path.instance.is_all(); let parent = if is_instance { Some(instance_path.entity_path.clone()) } else { @@ -943,8 +943,8 @@ fn blueprint_ui_for_data_result( instance_path: &InstancePath, ) { if let Some(space_view) = viewport.blueprint.space_view(&space_view_id) { - if instance_path.instance_key.is_splat() { - // splat - the whole entity + if instance_path.instance.is_all() { + // the whole entity let space_view_class = *space_view.class_identifier(); let entity_path = &instance_path.entity_path; diff --git a/crates/re_viewer_context/src/blueprint_helpers.rs b/crates/re_viewer_context/src/blueprint_helpers.rs index 1e77506d20aad..a07e5cc6f1403 100644 --- a/crates/re_viewer_context/src/blueprint_helpers.rs +++ b/crates/re_viewer_context/src/blueprint_helpers.rs @@ -1,5 +1,5 @@ use re_log_types::{DataCell, DataRow, EntityPath, RowId, TimeInt, TimePoint, Timeline}; -use re_types::{components::InstanceKey, AsComponents, ComponentBatch, ComponentName}; +use re_types::{AsComponents, ComponentBatch, ComponentName}; use crate::{StoreContext, SystemCommand, SystemCommandSender as _, ViewerContext}; @@ -78,26 +78,12 @@ impl ViewerContext<'_> { entity_path ); - let data_row_result = if num_instances == 1 { - let mut splat_cell: DataCell = [InstanceKey::SPLAT].into(); - splat_cell.compute_size_bytes(); - - DataRow::from_cells( - RowId::new(), - timepoint.clone(), - entity_path.clone(), - num_instances, - [splat_cell, data_cell], - ) - } else { - DataRow::from_cells( - RowId::new(), - timepoint.clone(), - entity_path.clone(), - num_instances, - [data_cell], - ) - }; + let data_row_result = DataRow::from_cells( + RowId::new(), + timepoint.clone(), + entity_path.clone(), + [data_cell], + ); match data_row_result { Ok(row) => self @@ -139,13 +125,7 @@ impl ViewerContext<'_> { let timepoint = self.store_context.blueprint_timepoint_for_writes(); let cell = DataCell::from_arrow_empty(component_name, datatype.clone()); - match DataRow::from_cells1( - RowId::new(), - entity_path.clone(), - timepoint.clone(), - cell.num_instances(), - cell, - ) { + match DataRow::from_cells1(RowId::new(), entity_path.clone(), timepoint.clone(), cell) { Ok(row) => self .command_sender .send_system(SystemCommand::UpdateBlueprint( diff --git a/crates/re_viewer_context/src/component_ui_registry.rs b/crates/re_viewer_context/src/component_ui_registry.rs index 756870c051ea8..76f1cf4cdde1c 100644 --- a/crates/re_viewer_context/src/component_ui_registry.rs +++ b/crates/re_viewer_context/src/component_ui_registry.rs @@ -2,8 +2,8 @@ use std::collections::BTreeMap; use re_data_store::LatestAtQuery; use re_entity_db::{external::re_query::LatestAtComponentResults, EntityDb, EntityPath}; -use re_log_types::DataCell; -use re_types::{components::InstanceKey, ComponentName, Loggable as _}; +use re_log_types::{DataCell, Instance}; +use re_types::ComponentName; use crate::ViewerContext; @@ -41,7 +41,7 @@ type ComponentUiCallback = Box< &EntityDb, &EntityPath, &LatestAtComponentResults, - &InstanceKey, + &Instance, ) + Send + Sync, >; @@ -56,7 +56,7 @@ type ComponentEditCallback = Box< &EntityPath, &EntityPath, &LatestAtComponentResults, - &InstanceKey, + &Instance, ) + Send + Sync, >; @@ -121,7 +121,7 @@ impl ComponentUiRegistry { db: &EntityDb, entity_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &InstanceKey, + instance: &Instance, ) { let Some(component_name) = component.component_name(db.resolver()) else { // TODO(#5607): what should happen if the promise is still pending? @@ -130,12 +130,6 @@ impl ComponentUiRegistry { re_tracing::profile_function!(component_name.full_name()); - if component_name == InstanceKey::name() { - // The user wants to show a ui for the `InstanceKey` component - well, that's easy: - ui.label(instance_key.to_string()); - return; - } - let ui_callback = self .component_uis .get(&component_name) @@ -148,7 +142,7 @@ impl ComponentUiRegistry { db, entity_path, component, - instance_key, + instance, ); } @@ -164,7 +158,7 @@ impl ComponentUiRegistry { entity_path: &EntityPath, override_path: &EntityPath, component: &LatestAtComponentResults, - instance_key: &InstanceKey, + instance: &Instance, ) { let Some(component_name) = component.component_name(db.resolver()) else { // TODO(#5607): what should happen if the promise is still pending? @@ -183,7 +177,7 @@ impl ComponentUiRegistry { entity_path, override_path, component, - instance_key, + instance, ); } else { // Even if we can't edit the component, it's still helpful to show what the value is. @@ -195,7 +189,7 @@ impl ComponentUiRegistry { db, entity_path, component, - instance_key, + instance, ); } } diff --git a/crates/re_viewer_context/src/item.rs b/crates/re_viewer_context/src/item.rs index 3fbdee8ca2994..613774d717851 100644 --- a/crates/re_viewer_context/src/item.rs +++ b/crates/re_viewer_context/src/item.rs @@ -78,26 +78,24 @@ impl std::str::FromStr for Item { fn from_str(s: &str) -> Result { let DataPath { entity_path, - instance_key, + instance, component_name, } = DataPath::from_str(s)?; - match (instance_key, component_name) { - (Some(instance_key), Some(_component_name)) => { + match (instance, component_name) { + (Some(instance), Some(_component_name)) => { // TODO(emilk): support selecting a specific component of a specific instance. - Err(re_log_types::PathParseError::UnexpectedInstanceKey( - instance_key, - )) + Err(re_log_types::PathParseError::UnexpectedInstance(instance)) } - (Some(instance_key), None) => Ok(Item::InstancePath(InstancePath::instance( + (Some(instance), None) => Ok(Item::InstancePath(InstancePath::instance( entity_path, - instance_key, + instance, ))), (None, Some(component_name)) => Ok(Item::ComponentPath(ComponentPath { entity_path, component_name, })), - (None, None) => Ok(Item::InstancePath(InstancePath::entity_splat(entity_path))), + (None, None) => Ok(Item::InstancePath(InstancePath::entity_all(entity_path))), } } } @@ -129,7 +127,7 @@ impl Item { re_log_types::StoreKind::Blueprint => "Blueprint ID", }, Item::InstancePath(instance_path) => { - if instance_path.instance_key.is_specific() { + if instance_path.instance.is_specific() { "Entity instance" } else { "Entity" @@ -139,7 +137,7 @@ impl Item { Item::SpaceView(_) => "Space view", Item::Container(_) => "Container", Item::DataResult(_, instance_path) => { - if instance_path.instance_key.is_specific() { + if instance_path.instance.is_specific() { "Data result instance" } else { "Data result entity" @@ -149,7 +147,7 @@ impl Item { } } -/// If the given item refers to the first element of an instance with a single element, resolve to a splatted entity path. +/// If the given item refers to the first element of an instance with a single element, resolve to a unindexed entity path. pub fn resolve_mono_instance_path_item( entity_db: &EntityDb, query: &re_data_store::LatestAtQuery, @@ -173,7 +171,7 @@ pub fn resolve_mono_instance_path_item( } } -/// If the given path refers to the first element of an instance with a single element, resolve to a splatted entity path. +/// If the given path refers to the first element of an instance with a single element, resolve to a unindexed entity path. pub fn resolve_mono_instance_path( entity_db: &EntityDb, query: &re_data_store::LatestAtQuery, @@ -181,14 +179,14 @@ pub fn resolve_mono_instance_path( ) -> re_entity_db::InstancePath { re_tracing::profile_function!(); - if instance.instance_key.0 == 0 { + if instance.instance.get() == 0 { // NOTE: While we normally frown upon direct queries to the datastore, `all_components` is fine. let Some(components) = entity_db .store() .all_components(&query.timeline(), &instance.entity_path) else { - // No components at all, return splatted entity. - return re_entity_db::InstancePath::entity_splat(instance.entity_path.clone()); + // No components at all, return unindexed entity. + return re_entity_db::InstancePath::entity_all(instance.entity_path.clone()); }; for component in components { @@ -208,8 +206,8 @@ pub fn resolve_mono_instance_path( } } - // All instances had only a single element or less, resolve to splatted entity. - return re_entity_db::InstancePath::entity_splat(instance.entity_path.clone()); + // All instances had only a single element or less, resolve to unindexed entity. + return re_entity_db::InstancePath::entity_all(instance.entity_path.clone()); } instance.clone() diff --git a/crates/re_viewer_context/src/selection_state.rs b/crates/re_viewer_context/src/selection_state.rs index 54ab55c2c3378..41d0341e6c230 100644 --- a/crates/re_viewer_context/src/selection_state.rs +++ b/crates/re_viewer_context/src/selection_state.rs @@ -106,7 +106,7 @@ where impl ItemCollection { /// For each item in this selection, if it refers to the first element of an instance with a - /// single element, resolve it to a splatted entity path. + /// single element, resolve it to a unindexed entity path. pub fn into_mono_instance_path_items(self, ctx: &ViewerContext<'_>) -> Self { ItemCollection( self.0 @@ -376,7 +376,7 @@ impl ApplicationSelectionState { } Item::InstancePath(test_instance_path) => { - !test_instance_path.instance_key.is_specific() + !test_instance_path.instance.is_specific() && test_instance_path.entity_path == component_path.entity_path } Item::DataResult(_, test_instance_path) => { @@ -396,8 +396,8 @@ impl ApplicationSelectionState { | Item::DataResult(_, test_instance_path) => { current_instance_path.entity_path == test_instance_path.entity_path && either_none_or_same( - ¤t_instance_path.instance_key.specific_index(), - &test_instance_path.instance_key.specific_index(), + ¤t_instance_path.instance.specific_index(), + &test_instance_path.instance.specific_index(), ) } }, @@ -414,8 +414,8 @@ impl ApplicationSelectionState { | Item::DataResult(_, test_instance_path) => { current_instance_path.entity_path == test_instance_path.entity_path && either_none_or_same( - ¤t_instance_path.instance_key.specific_index(), - &test_instance_path.instance_key.specific_index(), + ¤t_instance_path.instance.specific_index(), + &test_instance_path.instance.specific_index(), ) } }, diff --git a/crates/re_viewer_context/src/space_view/highlights.rs b/crates/re_viewer_context/src/space_view/highlights.rs index 72fbb7afad95c..0de5e24c9dd41 100644 --- a/crates/re_viewer_context/src/space_view/highlights.rs +++ b/crates/re_viewer_context/src/space_view/highlights.rs @@ -1,9 +1,8 @@ use nohash_hasher::IntMap; use re_entity_db::InstancePath; -use re_log_types::EntityPathHash; +use re_log_types::{EntityPathHash, Instance}; use re_renderer::OutlineMaskPreference; -use re_types::components::InstanceKey; use crate::{HoverHighlight, InteractionHighlight, SelectionHighlight}; @@ -13,15 +12,14 @@ use crate::{HoverHighlight, InteractionHighlight, SelectionHighlight}; #[derive(Default)] pub struct SpaceViewEntityHighlight { overall: InteractionHighlight, - instances: ahash::HashMap, + instances: ahash::HashMap, } impl SpaceViewEntityHighlight { /// Adds a new highlight to the entity highlight, combining it with existing highlights. #[inline] pub fn add(&mut self, instance: &InstancePath, highlight: InteractionHighlight) { - let highlight_target = if let Some(selected_index) = instance.instance_key.specific_index() - { + let highlight_target = if let Some(selected_index) = instance.instance.specific_index() { self.instances.entry(selected_index).or_default() } else { &mut self.overall @@ -59,11 +57,11 @@ pub struct OptionalSpaceViewEntityHighlight<'a>(Option<&'a SpaceViewEntityHighli impl<'a> OptionalSpaceViewEntityHighlight<'a> { #[inline] - pub fn index_highlight(&self, instance_key: InstanceKey) -> InteractionHighlight { + pub fn index_highlight(&self, instance: Instance) -> InteractionHighlight { match self.0 { Some(entity_highlight) => entity_highlight .instances - .get(&instance_key) + .get(&instance) .copied() .unwrap_or_default() .max(entity_highlight.overall), @@ -75,13 +73,13 @@ impl<'a> OptionalSpaceViewEntityHighlight<'a> { #[derive(Default)] pub struct SpaceViewOutlineMasks { pub overall: OutlineMaskPreference, - pub instances: ahash::HashMap, + pub instances: ahash::HashMap, } impl SpaceViewOutlineMasks { - pub fn index_outline_mask(&self, instance_key: InstanceKey) -> OutlineMaskPreference { + pub fn index_outline_mask(&self, instance: Instance) -> OutlineMaskPreference { self.instances - .get(&instance_key) + .get(&instance) .copied() .unwrap_or_default() .with_fallback_to(self.overall) @@ -89,12 +87,11 @@ impl SpaceViewOutlineMasks { /// Add a new outline mask to this entity path, combining it with existing masks. pub fn add(&mut self, instance: &InstancePath, preference: OutlineMaskPreference) { - let outline_mask_target = - if let Some(selected_index) = instance.instance_key.specific_index() { - self.instances.entry(selected_index).or_default() - } else { - &mut self.overall - }; + let outline_mask_target = if let Some(selected_index) = instance.instance.specific_index() { + self.instances.entry(selected_index).or_default() + } else { + &mut self.overall + }; *outline_mask_target = preference.with_fallback_to(*outline_mask_target); } } diff --git a/crates/re_viewport/src/context_menu/actions/collapse_expand_all.rs b/crates/re_viewport/src/context_menu/actions/collapse_expand_all.rs index 1baa7b91f8920..43f7cfe39f11b 100644 --- a/crates/re_viewport/src/context_menu/actions/collapse_expand_all.rs +++ b/crates/re_viewport/src/context_menu/actions/collapse_expand_all.rs @@ -69,7 +69,7 @@ impl ContextMenuAction for CollapseExpandAllAction { self.process_data_result( ctx, space_view_id, - &InstancePath::entity_splat(root_node.data_result.entity_path.clone()), + &InstancePath::entity_all(root_node.data_result.entity_path.clone()), ); } } diff --git a/crates/re_viewport/src/context_menu/actions/remove.rs b/crates/re_viewport/src/context_menu/actions/remove.rs index 838abe636990d..fc64df2e0d469 100644 --- a/crates/re_viewport/src/context_menu/actions/remove.rs +++ b/crates/re_viewport/src/context_menu/actions/remove.rs @@ -17,7 +17,7 @@ impl ContextMenuAction for RemoveAction { Item::Container(container_id) => { ctx.viewport_blueprint.root_container != Some(*container_id) } - Item::DataResult(_, instance_path) => instance_path.is_splat(), + Item::DataResult(_, instance_path) => instance_path.is_all(), _ => false, } } diff --git a/crates/re_viewport/src/context_menu/actions/show_hide.rs b/crates/re_viewport/src/context_menu/actions/show_hide.rs index 88de081807768..81900d6ead12b 100644 --- a/crates/re_viewport/src/context_menu/actions/show_hide.rs +++ b/crates/re_viewport/src/context_menu/actions/show_hide.rs @@ -118,7 +118,7 @@ fn data_result_visible( instance_path: &InstancePath, ) -> Option { instance_path - .is_splat() + .is_all() .then(|| { let query_result = ctx.viewer_context.lookup_query_result(*space_view_id); query_result diff --git a/crates/re_viewport/src/space_view_entity_picker.rs b/crates/re_viewport/src/space_view_entity_picker.rs index 23c268f67d63e..fa63f2e8398ad 100644 --- a/crates/re_viewport/src/space_view_entity_picker.rs +++ b/crates/re_viewport/src/space_view_entity_picker.rs @@ -179,7 +179,7 @@ fn add_entities_line_ui( ctx.recording(), ui, Some(space_view.id), - &InstancePath::entity_splat(entity_path.clone()), + &InstancePath::entity_all(entity_path.clone()), widget_text, ); if query_result.contains_entity(entity_path) { diff --git a/crates/re_viewport/src/viewport_blueprint_ui.rs b/crates/re_viewport/src/viewport_blueprint_ui.rs index 602d91c32e0a5..b97f351b615b8 100644 --- a/crates/re_viewport/src/viewport_blueprint_ui.rs +++ b/crates/re_viewport/src/viewport_blueprint_ui.rs @@ -140,7 +140,7 @@ impl Viewport<'_, '_> { Item::ComponentPath(component_path) => self.handle_focused_item( ctx, ui, - &Item::InstancePath(InstancePath::entity_splat( + &Item::InstancePath(InstancePath::entity_all( component_path.entity_path.clone(), )), ), @@ -539,7 +539,7 @@ impl Viewport<'_, '_> { { ctx.selection_state().set_selection(Item::DataResult( space_view.id, - InstancePath::entity_splat(entity_path.clone()), + InstancePath::entity_all(entity_path.clone()), )); } return; diff --git a/crates/rerun/src/sdk.rs b/crates/rerun/src/sdk.rs index e9fdcb9d85dac..a1a299f3e4863 100644 --- a/crates/rerun/src/sdk.rs +++ b/crates/rerun/src/sdk.rs @@ -23,9 +23,9 @@ mod prelude { // Also import any component or datatype that has a unique name: pub use re_types::components::{ - Color, HalfSizes2D, HalfSizes3D, InstanceKey, LineStrip2D, LineStrip3D, Material, - MediaType, MeshProperties, OutOfTreeTransform3D, Position2D, Position3D, Radius, Text, - TextLogLevel, Vector2D, Vector3D, + Color, HalfSizes2D, HalfSizes3D, LineStrip2D, LineStrip3D, Material, MediaType, + MeshProperties, OutOfTreeTransform3D, Position2D, Position3D, Radius, Text, TextLogLevel, + Vector2D, Vector3D, }; pub use re_types::datatypes::{ Angle, AnnotationInfo, ClassDescription, Float32, KeypointPair, Mat3x3, Quaternion, Rgba32, diff --git a/crates/rerun_c/src/lib.rs b/crates/rerun_c/src/lib.rs index 75844824e1c30..410d7b21cd1e8 100644 --- a/crates/rerun_c/src/lib.rs +++ b/crates/rerun_c/src/lib.rs @@ -166,7 +166,6 @@ pub struct CDataCell { #[repr(C)] pub struct CDataRow { pub entity_path: CStringView, - pub num_instances: u32, pub num_data_cells: u32, pub data_cells: *mut CDataCell, } @@ -631,7 +630,6 @@ fn rr_log_impl( let CDataRow { entity_path, - num_instances, num_data_cells, data_cells, } = data_row; @@ -640,9 +638,7 @@ fn rr_log_impl( let entity_path = EntityPath::parse_forgiving(entity_path); let num_data_cells = num_data_cells as usize; - re_log::debug!( - "rerun_log {entity_path:?}, num_instances: {num_instances}, num_data_cells: {num_data_cells}", - ); + re_log::debug!("rerun_log {entity_path:?}, num_data_cells: {num_data_cells}"); let mut cells = re_log_types::DataCellVec::default(); cells.reserve(num_data_cells); @@ -700,7 +696,6 @@ fn rr_log_impl( row_id, TimePoint::default(), // we use the one in the recording stream for now entity_path, - num_instances, cells, ) .map_err(|err| { diff --git a/crates/rerun_c/src/rerun.h b/crates/rerun_c/src/rerun.h index 3e12fca8543e0..2fa9e2f92bcf1 100644 --- a/crates/rerun_c/src/rerun.h +++ b/crates/rerun_c/src/rerun.h @@ -202,10 +202,6 @@ typedef struct { /// Where to log to, e.g. `world/camera`. rr_string entity_path; - /// Number of instances of this entity (e.g. number of points in a point - /// cloud). - uint32_t num_instances; - /// Number of components. uint32_t num_data_cells; diff --git a/docs/content/concepts/batches.md b/docs/content/concepts/batches.md index 93bb06d05314f..8348c8a3563c8 100644 --- a/docs/content/concepts/batches.md +++ b/docs/content/concepts/batches.md @@ -15,9 +15,9 @@ In the Python APIs, the majority of archetypes are named with the plural form, f ## Terminology - An *entity* is a collection of *components* (see [Entities and Components](entity-component.md)). -- When an entity is batched, it's components individual elements are called *instances*. -- When every instance within an entity has the same value for a component, that component is called a *splat*. This - is a common pattern and has dedicated support for it (see the [Splats](#splats) section below). +- When an entity is batched, its components' individual elements are called *instances*. +- When every instance within an entity shares the same value for a component, we say that this component is clamped. This + is a common pattern and has dedicated support for it (see the [Component Clamping](#component-clamping) section below). For instance, you can set all the colors of a point cloud to the same color by passing a single color value to the `color` parameter. - During queries, a batch always has a *primary* component. The primary component is what determines @@ -50,14 +50,11 @@ When querying a batched component, the component-values are joined together base Logically, this happens as a *left-join* using the primary component for the entity. For example, if you log 3 points and then later log 5 colors, you will still only see 3 points in the viewer. +What should happen if you have 5 points and 3 colors then? This is where clamping semantics come into play. -## Splats - -As mentioned, Rerun has special handling for splats within batches. This is what happens when you mix arrays and -single values in an API call. The non-array value is instead logged as a splat. Behind the scenes, the splat is stored -as a single value rather than a full array. Then, when doing the join at lookup time the splat is repeated across -every instance in the batch. - - +## Component clamping +As mentioned, Rerun has special semantics when joining batches of different sizes, for example this is what happens when you mix arrays and single values in an API call. +If the component on the left-side of the join (the so-called primary component) has more instances than the other, then these tail values will simply be ignored. +On the other hand, if the component on the left-side of the join (the so-called primary component) has less instances than the other, then the last instance will be repeated across every instance left in the batch. We call this clamping, in reference to texture sampling (think `CLAMP_TO_EDGE`!). diff --git a/docs/content/getting-started/data-in/cpp.md b/docs/content/getting-started/data-in/cpp.md index c2d7bbfb8cd1a..a0d1bbd2fb203 100644 --- a/docs/content/getting-started/data-in/cpp.md +++ b/docs/content/getting-started/data-in/cpp.md @@ -200,7 +200,7 @@ These are [_entity paths_](../../concepts/entity-component.md), which uniquely i One final observation: notice how we're logging a whole batch of points and colors all at once here. [Batches of data](../../concepts/batches.md) are first-class citizens in Rerun and come with all sorts of performance benefits and dedicated features. -You're looking at one of these dedicated features right now in fact: notice how we're only logging a single radius for all these points, yet somehow it applies to all of them. We call this _splatting_. +You're looking at one of these dedicated features right now in fact: notice how we're only logging a single radius for all these points, yet somehow it applies to all of them. We call this _clamping_. --- diff --git a/docs/content/getting-started/data-in/python.md b/docs/content/getting-started/data-in/python.md index 7b587def3bbe3..55d289b480696 100644 --- a/docs/content/getting-started/data-in/python.md +++ b/docs/content/getting-started/data-in/python.md @@ -134,7 +134,7 @@ These are [_entity paths_](../../concepts/entity-component.md), which uniquely i One final observation: notice how we're logging a whole batch of points and colors all at once here. [Batches of data](../../concepts/batches.md) are first-class citizens in Rerun and come with all sorts of performance benefits and dedicated features. -You're looking at one of these dedicated features right now in fact: notice how we're only logging a single radius for all these points, yet somehow it applies to all of them. We call this _splatting_. +You're looking at one of these dedicated features right now in fact: notice how we're only logging a single radius for all these points, yet somehow it applies to all of them. We call this _clamping_. --- diff --git a/docs/content/getting-started/data-in/rust.md b/docs/content/getting-started/data-in/rust.md index c6c3ee682228e..ae6c9e9c9986f 100644 --- a/docs/content/getting-started/data-in/rust.md +++ b/docs/content/getting-started/data-in/rust.md @@ -150,7 +150,7 @@ These are [_entity paths_](../../concepts/entity-component.md), which uniquely i One final observation: notice how we're logging a whole batch of points and colors all at once here. [Batches of data](../../concepts/batches.md) are first-class citizens in Rerun and come with all sorts of performance benefits and dedicated features. -You're looking at one of these dedicated features right now in fact: notice how we're only logging a single radius for all these points, yet somehow it applies to all of them. We call this _splatting_. +You're looking at one of these dedicated features right now in fact: notice how we're only logging a single radius for all these points, yet somehow it applies to all of them. We call this _clamping_. --- diff --git a/docs/snippets/all/custom_data.py b/docs/snippets/all/custom_data.py index 22becf1551d54..2e5661f15cd5d 100755 --- a/docs/snippets/all/custom_data.py +++ b/docs/snippets/all/custom_data.py @@ -52,7 +52,7 @@ def log_custom_data() -> None: "left/my_confident_point_cloud", CustomPoints3D( points3d=point_grid, - confidences=[42], # splat + confidences=[42], ), ) diff --git a/examples/rust/custom_space_view/src/color_coordinates_space_view.rs b/examples/rust/custom_space_view/src/color_coordinates_space_view.rs index 8c4bce111ac9d..a02e15e3c4efc 100644 --- a/examples/rust/custom_space_view/src/color_coordinates_space_view.rs +++ b/examples/rust/custom_space_view/src/color_coordinates_space_view.rs @@ -13,7 +13,7 @@ use re_viewer::external::{ }, }; -use crate::color_coordinates_visualizer_system::{ColorWithInstanceKey, InstanceColorSystem}; +use crate::color_coordinates_visualizer_system::{ColorWithInstance, InstanceColorSystem}; /// The different modes for displaying color coordinates in the custom space view. #[derive(Default, Debug, PartialEq, Clone, Copy)] @@ -237,12 +237,8 @@ fn color_space_ui( // Circles for the colors in the scene. for (ent_path, colors) in &colors.colors { let ent_highlight = query.highlights.entity_highlight(ent_path.hash()); - for ColorWithInstanceKey { - instance_key, - color, - } in colors - { - let highlight = ent_highlight.index_highlight(*instance_key); + for ColorWithInstance { instance, color } in colors { + let highlight = ent_highlight.index_highlight(*instance); let (x, y) = position_at(*color); let center = egui::pos2( @@ -265,12 +261,12 @@ fn color_space_ui( let interact = ui.interact( egui::Rect::from_center_size(center, egui::Vec2::splat(radius * 2.0)), - ui.id().with(("circle", &ent_path, instance_key)), + ui.id().with(("circle", &ent_path, instance)), egui::Sense::click(), ); // Update the global selection state if the user interacts with a point and show hover ui for the entire keypoint. - let instance = InstancePath::instance(ent_path.clone(), *instance_key); + let instance = InstancePath::instance(ent_path.clone(), *instance); let interact = interact.on_hover_ui_at_pointer(|ui| { item_ui::instance_path_button( ctx, diff --git a/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs b/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs index 07ef8f083bde4..01f85e2f2faa3 100644 --- a/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs +++ b/examples/rust/custom_space_view/src/color_coordinates_visualizer_system.rs @@ -1,12 +1,8 @@ use re_viewer::external::{ egui, - re_log_types::EntityPath, + re_log_types::{EntityPath, Instance}, re_query, re_renderer, - re_types::{ - self, - components::{Color, InstanceKey}, - ComponentName, Loggable as _, - }, + re_types::{self, components::Color, ComponentName, Loggable as _}, re_viewer_context::{ IdentifiedViewSystem, SpaceViewSystemExecutionError, ViewContextCollection, ViewQuery, ViewSystemIdentifier, ViewerContext, VisualizerQueryInfo, VisualizerSystem, @@ -16,12 +12,12 @@ use re_viewer::external::{ /// Our space view consist of single part which holds a list of egui colors for each entity path. #[derive(Default)] pub struct InstanceColorSystem { - pub colors: Vec<(EntityPath, Vec)>, + pub colors: Vec<(EntityPath, Vec)>, } -pub struct ColorWithInstanceKey { +pub struct ColorWithInstance { pub color: egui::Color32, - pub instance_key: InstanceKey, + pub instance: Instance, } struct ColorArchetype; @@ -90,11 +86,11 @@ impl VisualizerSystem for InstanceColorSystem { data_result.entity_path.clone(), (0..) .zip(colors) - .map(|(instance_key, color)| { + .map(|(instance, color)| { let [r, g, b, _] = color.to_array(); - ColorWithInstanceKey { + ColorWithInstance { color: egui::Color32::from_rgb(r, g, b), - instance_key: instance_key.into(), + instance: instance.into(), } }) .collect(), diff --git a/rerun_cpp/src/rerun.hpp b/rerun_cpp/src/rerun.hpp index d1885d164312c..10d087dcf56d7 100644 --- a/rerun_cpp/src/rerun.hpp +++ b/rerun_cpp/src/rerun.hpp @@ -32,7 +32,6 @@ namespace rerun { using components::Color; using components::HalfSizes2D; using components::HalfSizes3D; - using components::InstanceKey; using components::LineStrip2D; using components::LineStrip3D; using components::Material; diff --git a/rerun_cpp/src/rerun/archetypes/annotation_context.hpp b/rerun_cpp/src/rerun/archetypes/annotation_context.hpp index 49b8acf083d5c..fa34042fb2788 100644 --- a/rerun_cpp/src/rerun/archetypes/annotation_context.hpp +++ b/rerun_cpp/src/rerun/archetypes/annotation_context.hpp @@ -77,11 +77,6 @@ namespace rerun::archetypes { explicit AnnotationContext(rerun::components::AnnotationContext _context) : context(std::move(_context)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/arrows2d.hpp b/rerun_cpp/src/rerun/archetypes/arrows2d.hpp index e871a78f35226..2bfab90f4727f 100644 --- a/rerun_cpp/src/rerun/archetypes/arrows2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/arrows2d.hpp @@ -132,11 +132,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return vectors.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/arrows3d.hpp b/rerun_cpp/src/rerun/archetypes/arrows3d.hpp index 06857fccfc2c4..b801d3996cca9 100644 --- a/rerun_cpp/src/rerun/archetypes/arrows3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/arrows3d.hpp @@ -149,11 +149,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return vectors.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/asset3d.hpp b/rerun_cpp/src/rerun/archetypes/asset3d.hpp index 4aa8fdf7f09b3..aedac2b608e14 100644 --- a/rerun_cpp/src/rerun/archetypes/asset3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/asset3d.hpp @@ -133,11 +133,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/bar_chart.hpp b/rerun_cpp/src/rerun/archetypes/bar_chart.hpp index 80bcdbc666af2..4a69add9ebc2c 100644 --- a/rerun_cpp/src/rerun/archetypes/bar_chart.hpp +++ b/rerun_cpp/src/rerun/archetypes/bar_chart.hpp @@ -174,11 +174,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/boxes2d.hpp b/rerun_cpp/src/rerun/archetypes/boxes2d.hpp index 8496944dc40aa..70cc3bf45f9f5 100644 --- a/rerun_cpp/src/rerun/archetypes/boxes2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/boxes2d.hpp @@ -176,11 +176,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return half_sizes.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/boxes3d.hpp b/rerun_cpp/src/rerun/archetypes/boxes3d.hpp index dcf58d0fc4e46..f0b11c2ead69d 100644 --- a/rerun_cpp/src/rerun/archetypes/boxes3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/boxes3d.hpp @@ -185,11 +185,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return half_sizes.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/clear.hpp b/rerun_cpp/src/rerun/archetypes/clear.hpp index d77de84f31505..92d620fdcbe16 100644 --- a/rerun_cpp/src/rerun/archetypes/clear.hpp +++ b/rerun_cpp/src/rerun/archetypes/clear.hpp @@ -104,11 +104,6 @@ namespace rerun::archetypes { explicit Clear(rerun::components::ClearIsRecursive _is_recursive) : is_recursive(std::move(_is_recursive)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/depth_image.hpp b/rerun_cpp/src/rerun/archetypes/depth_image.hpp index e51c69ba0b662..ca12f37c3d019 100644 --- a/rerun_cpp/src/rerun/archetypes/depth_image.hpp +++ b/rerun_cpp/src/rerun/archetypes/depth_image.hpp @@ -143,11 +143,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp index 04328cbff25cf..76c1dbc5b8940 100644 --- a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp @@ -58,11 +58,6 @@ namespace rerun::archetypes { explicit DisconnectedSpace(rerun::components::DisconnectedSpace _disconnected_space) : disconnected_space(std::move(_disconnected_space)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/image.hpp b/rerun_cpp/src/rerun/archetypes/image.hpp index 48c5968463f9a..3e45e5bd3630f 100644 --- a/rerun_cpp/src/rerun/archetypes/image.hpp +++ b/rerun_cpp/src/rerun/archetypes/image.hpp @@ -132,11 +132,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp b/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp index 31a6a3aa70100..ea7590b061ef8 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp @@ -127,11 +127,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return strips.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp b/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp index 7027d459470ab..fe80208095714 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp @@ -122,11 +122,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return strips.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/mesh3d.hpp b/rerun_cpp/src/rerun/archetypes/mesh3d.hpp index 376940831ed15..1a1f90b6ed054 100644 --- a/rerun_cpp/src/rerun/archetypes/mesh3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/mesh3d.hpp @@ -165,11 +165,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return vertex_positions.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/pinhole.hpp b/rerun_cpp/src/rerun/archetypes/pinhole.hpp index a248d1185043f..2fcc47bd9f7b0 100644 --- a/rerun_cpp/src/rerun/archetypes/pinhole.hpp +++ b/rerun_cpp/src/rerun/archetypes/pinhole.hpp @@ -230,11 +230,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/points2d.hpp b/rerun_cpp/src/rerun/archetypes/points2d.hpp index 00a5cd08702d2..536d83b42686c 100644 --- a/rerun_cpp/src/rerun/archetypes/points2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/points2d.hpp @@ -165,11 +165,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return positions.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/points3d.hpp b/rerun_cpp/src/rerun/archetypes/points3d.hpp index 56316bb7dedbb..f586ebf87bf50 100644 --- a/rerun_cpp/src/rerun/archetypes/points3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/points3d.hpp @@ -147,11 +147,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return positions.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/scalar.hpp b/rerun_cpp/src/rerun/archetypes/scalar.hpp index 096281f37f75f..55f4268652d91 100644 --- a/rerun_cpp/src/rerun/archetypes/scalar.hpp +++ b/rerun_cpp/src/rerun/archetypes/scalar.hpp @@ -62,11 +62,6 @@ namespace rerun::archetypes { Scalar(Scalar&& other) = default; explicit Scalar(rerun::components::Scalar _scalar) : scalar(std::move(_scalar)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/segmentation_image.hpp b/rerun_cpp/src/rerun/archetypes/segmentation_image.hpp index dd8b33b7b84dc..e4cafe102b862 100644 --- a/rerun_cpp/src/rerun/archetypes/segmentation_image.hpp +++ b/rerun_cpp/src/rerun/archetypes/segmentation_image.hpp @@ -136,11 +136,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/series_line.hpp b/rerun_cpp/src/rerun/archetypes/series_line.hpp index cfb37e10062d8..316b9b8885d8f 100644 --- a/rerun_cpp/src/rerun/archetypes/series_line.hpp +++ b/rerun_cpp/src/rerun/archetypes/series_line.hpp @@ -108,11 +108,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/series_point.hpp b/rerun_cpp/src/rerun/archetypes/series_point.hpp index a3c4d81b3ea6b..2827a59cffb95 100644 --- a/rerun_cpp/src/rerun/archetypes/series_point.hpp +++ b/rerun_cpp/src/rerun/archetypes/series_point.hpp @@ -127,11 +127,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/tensor.hpp b/rerun_cpp/src/rerun/archetypes/tensor.hpp index 09d293b7b7db4..5a2689b689bbe 100644 --- a/rerun_cpp/src/rerun/archetypes/tensor.hpp +++ b/rerun_cpp/src/rerun/archetypes/tensor.hpp @@ -90,11 +90,6 @@ namespace rerun::archetypes { Tensor(Tensor&& other) = default; explicit Tensor(rerun::components::TensorData _data) : data(std::move(_data)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/text_document.hpp b/rerun_cpp/src/rerun/archetypes/text_document.hpp index f4a58edcec7f9..79b533d5405ea 100644 --- a/rerun_cpp/src/rerun/archetypes/text_document.hpp +++ b/rerun_cpp/src/rerun/archetypes/text_document.hpp @@ -112,11 +112,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/text_log.hpp b/rerun_cpp/src/rerun/archetypes/text_log.hpp index b072a3a3b9544..3a798321c7d13 100644 --- a/rerun_cpp/src/rerun/archetypes/text_log.hpp +++ b/rerun_cpp/src/rerun/archetypes/text_log.hpp @@ -117,11 +117,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/transform3d.hpp b/rerun_cpp/src/rerun/archetypes/transform3d.hpp index 3de4117ae71e7..202221d506da9 100644 --- a/rerun_cpp/src/rerun/archetypes/transform3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/transform3d.hpp @@ -241,11 +241,6 @@ namespace rerun::archetypes { explicit Transform3D(rerun::components::Transform3D _transform) : transform(std::move(_transform)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/archetypes/view_coordinates.hpp b/rerun_cpp/src/rerun/archetypes/view_coordinates.hpp index 8c014115270fd..fe4e72ca9e8d6 100644 --- a/rerun_cpp/src/rerun/archetypes/view_coordinates.hpp +++ b/rerun_cpp/src/rerun/archetypes/view_coordinates.hpp @@ -129,11 +129,6 @@ namespace rerun::archetypes { ViewCoordinates(ViewCoordinates&& other) = default; explicit ViewCoordinates(rerun::components::ViewCoordinates _xyz) : xyz(std::move(_xyz)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/background3d.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/background3d.hpp index e1e97d9b85ddc..9d6685bcb1882 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/background3d.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/background3d.hpp @@ -49,11 +49,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp index 68ea24df18c67..f6c00a057ee84 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/container_blueprint.hpp @@ -150,11 +150,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp index 7a903fa0d7a64..5b0c9717af326 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/panel_blueprint.hpp @@ -38,11 +38,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/plot_legend.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/plot_legend.hpp index 9d4579a1e7147..faba0b359011d 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/plot_legend.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/plot_legend.hpp @@ -57,11 +57,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/scalar_axis.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/scalar_axis.hpp index ebe2cd90ef5ac..edd76fd99ce6d 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/scalar_axis.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/scalar_axis.hpp @@ -55,11 +55,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp index af7afab96d44d..58bcf19f48087 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/space_view_blueprint.hpp @@ -85,11 +85,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp index fbbee2e116fd2..1e116634a4644 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/space_view_contents.hpp @@ -71,11 +71,6 @@ namespace rerun::blueprint::archetypes { explicit SpaceViewContents(Collection _query) : query(std::move(_query)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return query.size(); - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp index 3189bf8e2b7c2..63dbeedb5d3ee 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/viewport_blueprint.hpp @@ -116,11 +116,6 @@ namespace rerun::blueprint::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::blueprint::archetypes diff --git a/rerun_cpp/src/rerun/c/rerun.h b/rerun_cpp/src/rerun/c/rerun.h index 614f3f5c3d41c..fb3065e41fa32 100644 --- a/rerun_cpp/src/rerun/c/rerun.h +++ b/rerun_cpp/src/rerun/c/rerun.h @@ -202,10 +202,6 @@ typedef struct { /// Where to log to, e.g. `world/camera`. rr_string entity_path; - /// Number of instances of this entity (e.g. number of points in a point - /// cloud). - uint32_t num_instances; - /// Number of components. uint32_t num_data_cells; @@ -268,7 +264,7 @@ typedef struct rr_error { /// /// This should match the string returned by `rr_version_string`. /// If not, the SDK's binary and the C header are out of sync. -#define RERUN_SDK_HEADER_VERSION "0.16.0-alpha.1+dev" +#define RERUN_SDK_HEADER_VERSION "0.16.0-alpha.2" /// Returns a human-readable version string of the Rerun C SDK. /// diff --git a/rerun_cpp/src/rerun/recording_stream.cpp b/rerun_cpp/src/rerun/recording_stream.cpp index e470d62f1b83c..05afcb43af903 100644 --- a/rerun_cpp/src/rerun/recording_stream.cpp +++ b/rerun_cpp/src/rerun/recording_stream.cpp @@ -1,6 +1,5 @@ #include "recording_stream.hpp" #include "c/rerun.h" -#include "components/instance_key.hpp" #include "config.hpp" #include "data_cell.hpp" #include "sdk_info.hpp" @@ -12,8 +11,6 @@ #include namespace rerun { - static const auto splat_key = components::InstanceKey(std::numeric_limits::max()); - static rr_store_kind store_kind_to_c(StoreKind store_kind) { switch (store_kind) { case StoreKind::Recording: @@ -194,47 +191,21 @@ namespace rerun { if (!is_enabled()) { return Error::ok(); } - size_t num_instances_max = 0; - for (const auto& batch : batches) { - num_instances_max = std::max(num_instances_max, batch.num_instances); - } std::vector instanced; - std::vector splatted; for (const auto& batch : batches) { - if (num_instances_max > 1 && batch.num_instances == 1) { - splatted.push_back(std::move(batch)); - } else { - instanced.push_back(std::move(batch)); - } + instanced.push_back(std::move(batch)); } bool inject_time = !static_; - if (!splatted.empty()) { - splatted.push_back( - std::move(DataCell::from_loggable(splat_key).value) - ); - auto result = - try_log_data_row(entity_path, 1, splatted.size(), splatted.data(), inject_time); - if (result.is_err()) { - return result; - } - } - - return try_log_data_row( - entity_path, - num_instances_max, - instanced.size(), - instanced.data(), - inject_time - ); + return try_log_data_row(entity_path, instanced.size(), instanced.data(), inject_time); } Error RecordingStream::try_log_data_row( - std::string_view entity_path, size_t num_instances, size_t num_data_cells, - const DataCell* data_cells, bool inject_time + std::string_view entity_path, size_t num_data_cells, const DataCell* data_cells, + bool inject_time ) const { if (!is_enabled()) { return Error::ok(); @@ -247,7 +218,6 @@ namespace rerun { rr_data_row c_data_row; c_data_row.entity_path = detail::to_rr_string(entity_path); - c_data_row.num_instances = static_cast(num_instances); c_data_row.num_data_cells = static_cast(num_data_cells); c_data_row.data_cells = c_data_cells.data(); diff --git a/rerun_cpp/src/rerun/recording_stream.hpp b/rerun_cpp/src/rerun/recording_stream.hpp index 4646b44ebdcf7..535ece41a44fd 100644 --- a/rerun_cpp/src/rerun/recording_stream.hpp +++ b/rerun_cpp/src/rerun/recording_stream.hpp @@ -531,8 +531,6 @@ namespace rerun { /// In order to use this you need to pass serialized Arrow data cells. /// /// \param entity_path Path to the entity in the space hierarchy. - /// \param num_instances - /// Each cell is expected to hold exactly `num_instances` instances. /// \param num_data_cells Number of data cells passed in. /// \param data_cells The data cells to log. /// \param inject_time @@ -541,8 +539,8 @@ namespace rerun { /// /// \see `try_log_serialized_batches` Error try_log_data_row( - std::string_view entity_path, size_t num_instances, size_t num_data_cells, - const DataCell* data_cells, bool inject_time + std::string_view entity_path, size_t num_data_cells, const DataCell* data_cells, + bool inject_time ) const; /// Logs the file at the given `path` using all `DataLoader`s available. diff --git a/rerun_cpp/tests/generated/archetypes/affix_fuzzer1.hpp b/rerun_cpp/tests/generated/archetypes/affix_fuzzer1.hpp index daed9e4c613ab..f4c3a1860b474 100644 --- a/rerun_cpp/tests/generated/archetypes/affix_fuzzer1.hpp +++ b/rerun_cpp/tests/generated/archetypes/affix_fuzzer1.hpp @@ -126,11 +126,6 @@ namespace rerun::archetypes { fuzz1020(std::move(_fuzz1020)), fuzz1021(std::move(_fuzz1021)), fuzz1022(std::move(_fuzz1022)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 1; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/tests/generated/archetypes/affix_fuzzer2.hpp b/rerun_cpp/tests/generated/archetypes/affix_fuzzer2.hpp index 17a560cc1b313..1a1714d18eaec 100644 --- a/rerun_cpp/tests/generated/archetypes/affix_fuzzer2.hpp +++ b/rerun_cpp/tests/generated/archetypes/affix_fuzzer2.hpp @@ -122,11 +122,6 @@ namespace rerun::archetypes { fuzz1117(std::move(_fuzz1117)), fuzz1118(std::move(_fuzz1118)), fuzz1122(std::move(_fuzz1122)) {} - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return fuzz1101.size(); - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/tests/generated/archetypes/affix_fuzzer3.hpp b/rerun_cpp/tests/generated/archetypes/affix_fuzzer3.hpp index 1004ff15c502f..c1fbb4577e93d 100644 --- a/rerun_cpp/tests/generated/archetypes/affix_fuzzer3.hpp +++ b/rerun_cpp/tests/generated/archetypes/affix_fuzzer3.hpp @@ -188,11 +188,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::archetypes diff --git a/rerun_cpp/tests/generated/archetypes/affix_fuzzer4.hpp b/rerun_cpp/tests/generated/archetypes/affix_fuzzer4.hpp index 4ecf384f7ca5d..c113d6bb68547 100644 --- a/rerun_cpp/tests/generated/archetypes/affix_fuzzer4.hpp +++ b/rerun_cpp/tests/generated/archetypes/affix_fuzzer4.hpp @@ -188,11 +188,6 @@ namespace rerun::archetypes { // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) } - - /// Returns the number of primary instances of this archetype. - size_t num_instances() const { - return 0; - } }; } // namespace rerun::archetypes diff --git a/rerun_py/rerun_sdk/rerun/_baseclasses.py b/rerun_py/rerun_sdk/rerun/_baseclasses.py index ba3c366be7599..3edab8fb68a0b 100644 --- a/rerun_py/rerun_sdk/rerun/_baseclasses.py +++ b/rerun_py/rerun_sdk/rerun/_baseclasses.py @@ -18,12 +18,7 @@ def component_name(self) -> str: ... def as_arrow_array(self) -> pa.Array: - """ - Returns a `pyarrow.Array` of the component data. - - Each element in the array corresponds to an instance of the component. Single-instanced - components and splats must still be represented as a 1-element array. - """ + """Returns a `pyarrow.Array` of the component data.""" ... diff --git a/rerun_py/rerun_sdk/rerun/_log.py b/rerun_py/rerun_sdk/rerun/_log.py index 1b3573e8ebcee..477eb05f8ce0f 100644 --- a/rerun_py/rerun_sdk/rerun/_log.py +++ b/rerun_py/rerun_sdk/rerun/_log.py @@ -6,7 +6,6 @@ import pyarrow as pa import rerun_bindings as bindings -from . import components as cmp from ._baseclasses import AsComponents, ComponentBatchLike from .error_utils import _send_warning_or_raise, catch_and_log_exceptions from .recording_stream import RecordingStream @@ -47,13 +46,6 @@ def as_arrow_array(self) -> pa.Array: return self.data -def _splat() -> cmp.InstanceKeyBatch: - """Helper to generate a splat InstanceKeyArray.""" - - _MAX_U64 = 2**64 - 1 - return pa.array([_MAX_U64], type=cmp.InstanceKeyType().storage_type) # type: ignore[no-any-return] - - @catch_and_log_exceptions() def log( entity_path: str | list[str], @@ -269,7 +261,6 @@ def log_components( recording = RecordingStream.to_native(recording) instanced: dict[str, pa.Array] = {} - splats: dict[str, pa.Array] = {} components = list(components) @@ -306,21 +297,8 @@ def log_components( if isinstance(array, pa.ExtensionArray): array = array.storage - if len(array) == 1 and num_instances > 1: - splats[name] = array - else: - instanced[name] = array - - if splats: - splats["rerun.components.InstanceKey"] = _splat() - bindings.log_arrow_msg( # pyright: ignore[reportGeneralTypeIssues] - entity_path, - components=splats, - static_=static, - recording=recording, - ) + instanced[name] = array - # Always log the instanced components last so range-based queries will include the other data. See(#1215) bindings.log_arrow_msg( # pyright: ignore[reportGeneralTypeIssues] entity_path, components=instanced, diff --git a/rerun_py/rerun_sdk/rerun/any_value.py b/rerun_py/rerun_sdk/rerun/any_value.py index 75396f74eed7d..9b45fd7711391 100644 --- a/rerun_py/rerun_sdk/rerun/any_value.py +++ b/rerun_py/rerun_sdk/rerun/any_value.py @@ -120,9 +120,6 @@ def __init__(self, drop_untyped_nones: bool = True, **kwargs: Any) -> None: general, if you can pass it to [pyarrow.array][] you can log it as a extension component. - All values must either have the same length, or be singular in which - case they will be treated as a splat. - Note: rerun requires that a given component only take on a single type. The first type logged will be the type that is used for all future logs of that component. The API will make a best effort to do type conversion diff --git a/rerun_py/src/arrow.rs b/rerun_py/src/arrow.rs index a305cb856e33d..23b0e549a1c7f 100644 --- a/rerun_py/src/arrow.rs +++ b/rerun_py/src/arrow.rs @@ -68,15 +68,8 @@ pub fn build_data_row_from_components( .map(|(value, field)| DataCell::from_arrow(field.name.into(), value)) .collect_vec(); - let num_instances = cells.first().map_or(0, |cell| cell.num_instances()); - let row = DataRow::from_cells( - row_id, - time_point.clone(), - entity_path.clone(), - num_instances, - cells, - ) - .map_err(|err| PyValueError::new_err(err.to_string()))?; + let row = DataRow::from_cells(row_id, time_point.clone(), entity_path.clone(), cells) + .map_err(|err| PyValueError::new_err(err.to_string()))?; Ok(row) } diff --git a/tests/python/test_api/test_api.py b/tests/python/test_api/test_api.py index e94dc68f98ef9..36a41092d67b2 100755 --- a/tests/python/test_api/test_api.py +++ b/tests/python/test_api/test_api.py @@ -361,7 +361,6 @@ def run_extension_component() -> None: rr.log("extension_components/point", rr.AnyValues(confidence=0.9)) # Batch points with extension - # Note: each extension component must either be length 1 (a splat) or the same length as the batch rr.set_time_seconds("sim_time", 1) rr.log( "extension_components/points",