From 512a67175299adb27b5de304b6bf7100ff829c26 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 18 Dec 2024 19:03:53 +0100 Subject: [PATCH] Less arrow2 --- Cargo.lock | 3 + crates/store/re_chunk/src/builder.rs | 18 +++++ crates/store/re_query/src/latest_at.rs | 13 +++- crates/viewer/re_component_ui/Cargo.toml | 1 + .../src/datatype_uis/singleline_string.rs | 9 ++- .../viewer/re_component_ui/src/fallback_ui.rs | 12 +++- .../re_data_ui/src/component_ui_registry.rs | 2 +- crates/viewer/re_selection_panel/Cargo.toml | 1 + .../re_selection_panel/src/defaults_ui.rs | 2 +- .../re_selection_panel/src/visualizer_ui.rs | 31 ++++---- crates/viewer/re_view/src/view_property_ui.rs | 4 +- crates/viewer/re_view_dataframe/Cargo.toml | 1 + .../src/display_record_batch.rs | 4 +- .../viewer/re_view_graph/src/ui/selection.rs | 5 +- .../src/visualizers/utilities/labels.rs | 4 +- .../re_viewer/src/blueprint/validation.rs | 2 +- .../src/blueprint_helpers.rs | 18 ++--- .../src/component_ui_registry.rs | 72 +++++++++---------- crates/viewer/re_viewer_context/src/item.rs | 2 +- .../src/view/view_context.rs | 3 +- .../viewer/re_viewport_blueprint/src/view.rs | 2 +- .../src/view_contents.rs | 4 +- examples/rust/extend_viewer_ui/src/main.rs | 2 +- 23 files changed, 119 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0bf98eb72cf9..d1b14fa53311 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5701,6 +5701,7 @@ dependencies = [ name = "re_component_ui" version = "0.21.0-alpha.1+dev" dependencies = [ + "arrow", "egui", "egui_extras", "egui_plot", @@ -6297,6 +6298,7 @@ dependencies = [ name = "re_selection_panel" version = "0.21.0-alpha.1+dev" dependencies = [ + "arrow", "egui", "egui_tiles", "itertools 0.13.0", @@ -6597,6 +6599,7 @@ name = "re_view_dataframe" version = "0.21.0-alpha.1+dev" dependencies = [ "anyhow", + "arrow", "egui", "egui_table", "itertools 0.13.0", diff --git a/crates/store/re_chunk/src/builder.rs b/crates/store/re_chunk/src/builder.rs index 48ff0facdad4..33a0c449d950 100644 --- a/crates/store/re_chunk/src/builder.rs +++ b/crates/store/re_chunk/src/builder.rs @@ -1,3 +1,4 @@ +use arrow::array::ArrayRef; use arrow2::{ array::{Array as Arrow2Array, PrimitiveArray as Arrow2PrimitiveArray}, datatypes::DataType as Arrow2Datatype, @@ -99,6 +100,23 @@ impl ChunkBuilder { self } + /// Add a row's worth of data using the given component data. + #[inline] + pub fn with_row_arrow1( + self, + row_id: RowId, + timepoint: impl Into, + components: impl IntoIterator, + ) -> Self { + self.with_sparse_row( + row_id, + timepoint, + components + .into_iter() + .map(|(component_descr, array)| (component_descr, Some(array.into()))), + ) + } + /// Add a row's worth of data using the given component data. #[inline] pub fn with_row( diff --git a/crates/store/re_query/src/latest_at.rs b/crates/store/re_query/src/latest_at.rs index efc84879ae44..2bca910b2d12 100644 --- a/crates/store/re_query/src/latest_at.rs +++ b/crates/store/re_query/src/latest_at.rs @@ -12,7 +12,8 @@ use re_chunk::{Chunk, RowId, UnitChunkShared}; use re_chunk_store::{ChunkStore, LatestAtQuery, TimeInt}; use re_log_types::EntityPath; use re_types_core::{ - components::ClearIsRecursive, Component, ComponentDescriptor, ComponentName, SizeBytes, + components::ClearIsRecursive, external::arrow::array::ArrayRef, Component, ComponentDescriptor, + ComponentName, SizeBytes, }; use crate::{QueryCache, QueryCacheKey, QueryError}; @@ -313,7 +314,15 @@ impl LatestAtResults { /// Returns the raw data for the specified component. #[inline] - pub fn component_batch_raw( + pub fn component_batch_raw(&self, component_name: &ComponentName) -> Option { + self.components + .get(component_name)? + .component_batch_raw(component_name) + } + + /// Returns the raw data for the specified component. + #[inline] + pub fn component_batch_raw_arrow2( &self, component_name: &ComponentName, ) -> Option> { diff --git a/crates/viewer/re_component_ui/Cargo.toml b/crates/viewer/re_component_ui/Cargo.toml index eac5afe72e67..e77648689bab 100644 --- a/crates/viewer/re_component_ui/Cargo.toml +++ b/crates/viewer/re_component_ui/Cargo.toml @@ -32,6 +32,7 @@ re_types_core.workspace = true re_ui.workspace = true re_viewer_context.workspace = true +arrow.workspace = true egui_extras.workspace = true egui_plot.workspace = true egui.workspace = true diff --git a/crates/viewer/re_component_ui/src/datatype_uis/singleline_string.rs b/crates/viewer/re_component_ui/src/datatype_uis/singleline_string.rs index faa912c0f64c..510ca3755bfa 100644 --- a/crates/viewer/re_component_ui/src/datatype_uis/singleline_string.rs +++ b/crates/viewer/re_component_ui/src/datatype_uis/singleline_string.rs @@ -1,7 +1,6 @@ use re_types::{ components::{Name, Text}, datatypes::Utf8, - external::arrow2, Loggable as _, }; use re_ui::UiExt as _; @@ -84,9 +83,9 @@ pub fn display_text_ui( _db: &EntityDb, _path: &EntityPath, _row_id: Option, - data: &dyn arrow2::array::Array, + data: &dyn arrow::array::Array, ) { - let text = match Text::from_arrow2(data) { + let text = match Text::from_arrow(data) { Ok(text) => text.first().cloned(), Err(err) => { ui.error_label("Failed to deserialize") @@ -113,9 +112,9 @@ pub fn display_name_ui( _db: &EntityDb, _path: &EntityPath, _row_id: Option, - data: &dyn arrow2::array::Array, + data: &dyn arrow::array::Array, ) { - let name = match Name::from_arrow2(data) { + let name = match Name::from_arrow(data) { Ok(name) => name.first().cloned(), Err(err) => { ui.error_label("Failed to deserialize") diff --git a/crates/viewer/re_component_ui/src/fallback_ui.rs b/crates/viewer/re_component_ui/src/fallback_ui.rs index e392916fdf4b..73ddab380bea 100644 --- a/crates/viewer/re_component_ui/src/fallback_ui.rs +++ b/crates/viewer/re_component_ui/src/fallback_ui.rs @@ -17,12 +17,20 @@ pub fn fallback_component_ui( _db: &EntityDb, _entity_path: &EntityPath, _row_id: Option, - component: &dyn arrow2::array::Array, + component: &dyn arrow::array::Array, ) { arrow_ui(ui, ui_layout, component); } -fn arrow_ui(ui: &mut egui::Ui, ui_layout: UiLayout, array: &dyn arrow2::array::Array) { +fn arrow_ui(ui: &mut egui::Ui, ui_layout: UiLayout, array: &dyn arrow::array::Array) { + arrow2_ui( + ui, + ui_layout, + Box::::from(array).as_ref(), + ); +} + +fn arrow2_ui(ui: &mut egui::Ui, ui_layout: UiLayout, array: &dyn arrow2::array::Array) { use re_types::SizeBytes as _; // Special-treat text. diff --git a/crates/viewer/re_data_ui/src/component_ui_registry.rs b/crates/viewer/re_data_ui/src/component_ui_registry.rs index b0c4fab22e6d..b9218eaffaa0 100644 --- a/crates/viewer/re_data_ui/src/component_ui_registry.rs +++ b/crates/viewer/re_data_ui/src/component_ui_registry.rs @@ -23,7 +23,7 @@ pub fn add_to_registry(registry: &mut Com registry.add_legacy_display_ui( C::name(), Box::new( - |ctx, ui, ui_layout, query, db, entity_path, row_id, component_raw| match C::from_arrow2( + |ctx, ui, ui_layout, query, db, entity_path, row_id, component_raw| match C::from_arrow( component_raw, ) { Ok(components) => match components.len() { diff --git a/crates/viewer/re_selection_panel/Cargo.toml b/crates/viewer/re_selection_panel/Cargo.toml index aa09cf939c9a..3c55589ee298 100644 --- a/crates/viewer/re_selection_panel/Cargo.toml +++ b/crates/viewer/re_selection_panel/Cargo.toml @@ -35,6 +35,7 @@ re_ui.workspace = true re_viewer_context.workspace = true re_viewport_blueprint.workspace = true +arrow.workspace = true egui_tiles.workspace = true egui.workspace = true itertools.workspace = true diff --git a/crates/viewer/re_selection_panel/src/defaults_ui.rs b/crates/viewer/re_selection_panel/src/defaults_ui.rs index adcbadb7b77a..603a5301bede 100644 --- a/crates/viewer/re_selection_panel/src/defaults_ui.rs +++ b/crates/viewer/re_selection_panel/src/defaults_ui.rs @@ -201,7 +201,7 @@ fn active_defaults( db.storage_engine() .cache() .latest_at(query, &view.defaults_path, [*c]) - .component_batch_raw(c) + .component_batch_raw_arrow2(c) .map_or(false, |data| !data.is_empty()) }) .collect::>() diff --git a/crates/viewer/re_selection_panel/src/visualizer_ui.rs b/crates/viewer/re_selection_panel/src/visualizer_ui.rs index e8e04c99ad15..488da5d24e99 100644 --- a/crates/viewer/re_selection_panel/src/visualizer_ui.rs +++ b/crates/viewer/re_selection_panel/src/visualizer_ui.rs @@ -5,7 +5,7 @@ use re_data_ui::{sorted_component_list_for_ui, DataUi}; use re_entity_db::EntityDb; use re_log_types::{ComponentPath, EntityPath}; use re_types::blueprint::components::VisualizerOverrides; -use re_types::external::arrow2; +use re_types_core::external::arrow::array::ArrayRef; use re_ui::{list_item, UiExt as _}; use re_view::latest_at_with_blueprint_resolved_data; use re_viewer_context::{ @@ -160,9 +160,9 @@ fn visualizer_components( fn non_empty_component_batch_raw( unit: Option<&UnitChunkShared>, component_name: &ComponentName, - ) -> Option<(Option, Box)> { + ) -> Option<(Option, ArrayRef)> { let unit = unit?; - let batch = unit.component_batch_raw_arrow2(component_name)?; + let batch = unit.component_batch_raw(component_name)?; if batch.is_empty() { None } else { @@ -205,10 +205,9 @@ fn visualizer_components( let result_default = query_result.defaults.get(&component_name); let raw_default = non_empty_component_batch_raw(result_default, &component_name); - let raw_fallback: Box = visualizer + let raw_fallback = visualizer .fallback_provider() - .fallback_for(&query_ctx, component_name) - .into(); + .fallback_for(&query_ctx, component_name); // Determine where the final value comes from. // Putting this into an enum makes it easier to reason about the next steps. @@ -398,8 +397,8 @@ fn visualizer_components( override_path, &raw_override.clone().map(|(_, raw_override)| raw_override), raw_default.clone().map(|(_, raw_override)| raw_override), - raw_fallback.as_ref(), - raw_current_value.as_ref(), + raw_fallback.clone(), + raw_current_value.clone(), ); }), add_children, @@ -418,7 +417,7 @@ fn editable_blueprint_component_list_item( blueprint_path: &EntityPath, component: re_types::ComponentName, row_id: Option, - raw_override: &dyn arrow2::array::Array, + raw_override: &dyn arrow::array::Array, ) -> egui::Response { ui.list_item_flat_noninteractive( list_item::PropertyContent::new(name) @@ -450,10 +449,10 @@ fn menu_more( ui: &mut egui::Ui, component_name: re_types::ComponentName, override_path: &EntityPath, - raw_override: &Option>, - raw_default: Option>, - raw_fallback: &dyn arrow2::array::Array, - raw_current_value: &dyn arrow2::array::Array, + raw_override: &Option, + raw_default: Option, + raw_fallback: arrow::array::ArrayRef, + raw_current_value: arrow::array::ArrayRef, ) { if ui .add_enabled(raw_override.is_some(), egui::Button::new("Remove override")) @@ -479,14 +478,14 @@ fn menu_more( } if ui.button("Set to fallback value").clicked() { - ctx.save_blueprint_array(override_path, component_name, raw_fallback.to_boxed()); + ctx.save_blueprint_array(override_path, component_name, raw_fallback); ui.close_menu(); } let override_differs_from_default = raw_override != &ctx .viewer_ctx - .raw_latest_at_in_default_blueprint_arrow2(override_path, component_name); + .raw_latest_at_in_default_blueprint(override_path, component_name); if ui .add_enabled( override_differs_from_default, @@ -504,7 +503,7 @@ fn menu_more( ctx.save_blueprint_array( &ViewBlueprint::defaults_path(ctx.view_id), component_name, - raw_current_value.to_boxed(), + raw_current_value, ); ui.close_menu(); } diff --git a/crates/viewer/re_view/src/view_property_ui.rs b/crates/viewer/re_view/src/view_property_ui.rs index 1307c2d41ea4..995a3825803b 100644 --- a/crates/viewer/re_view/src/view_property_ui.rs +++ b/crates/viewer/re_view/src/view_property_ui.rs @@ -89,9 +89,7 @@ pub fn view_property_component_ui( field: &ArchetypeFieldReflection, fallback_provider: &dyn ComponentFallbackProvider, ) { - let component_array: Option> = property - .component_raw(field.component_name) - .map(|array| array.into()); + let component_array = property.component_raw(field.component_name); let row_id = property.component_row_id(field.component_name); let ui_types = ctx diff --git a/crates/viewer/re_view_dataframe/Cargo.toml b/crates/viewer/re_view_dataframe/Cargo.toml index 871c6cab85f9..425b6bd42e62 100644 --- a/crates/viewer/re_view_dataframe/Cargo.toml +++ b/crates/viewer/re_view_dataframe/Cargo.toml @@ -33,6 +33,7 @@ re_viewer_context.workspace = true re_viewport_blueprint.workspace = true anyhow.workspace = true +arrow.workspace = true egui_table.workspace = true egui.workspace = true itertools.workspace = true diff --git a/crates/viewer/re_view_dataframe/src/display_record_batch.rs b/crates/viewer/re_view_dataframe/src/display_record_batch.rs index e8217b0ca165..6260f74cb7e0 100644 --- a/crates/viewer/re_view_dataframe/src/display_record_batch.rs +++ b/crates/viewer/re_view_dataframe/src/display_record_batch.rs @@ -145,6 +145,8 @@ impl ComponentData { data }; + let data_to_display: arrow::array::ArrayRef = data_to_display.into(); + ctx.component_ui_registry.ui_raw( ctx, ui, @@ -154,7 +156,7 @@ impl ComponentData { entity_path, component_name, None, - &*data_to_display, + data_to_display.as_ref(), ); } else { ui.label("-"); diff --git a/crates/viewer/re_view_graph/src/ui/selection.rs b/crates/viewer/re_view_graph/src/ui/selection.rs index 659e4dbb120e..d8b8906051bc 100644 --- a/crates/viewer/re_view_graph/src/ui/selection.rs +++ b/crates/viewer/re_view_graph/src/ui/selection.rs @@ -1,4 +1,3 @@ -use re_chunk::Arrow2Array; use re_types::{ blueprint::components::Enabled, Archetype, ArchetypeReflectionMarker, Component as _, }; @@ -62,9 +61,7 @@ pub fn view_property_force_ui( .find(|field| field.component_name == Enabled::name()) .expect("forces are required to have an `Enabled` component"); - let component_array: Option> = property - .component_raw(field.component_name) - .map(|array| array.into()); + let component_array = property.component_raw(field.component_name); let row_id = property.component_row_id(field.component_name); let singleline_ui: &dyn Fn(&mut egui::Ui) = &|ui| { diff --git a/crates/viewer/re_view_spatial/src/visualizers/utilities/labels.rs b/crates/viewer/re_view_spatial/src/visualizers/utilities/labels.rs index ea72d531b5b4..6b238c651666 100644 --- a/crates/viewer/re_view_spatial/src/visualizers/utilities/labels.rs +++ b/crates/viewer/re_view_spatial/src/visualizers/utilities/labels.rs @@ -115,10 +115,10 @@ pub fn show_labels_fallback(ctx: &re_viewer_context::QueryContext< ctx.recording() .latest_at(ctx.query, ctx.target_entity_path, [C::name(), Text::name()]); let num_instances = results - .component_batch_raw(&C::name()) + .component_batch_raw_arrow2(&C::name()) .map_or(0, |array| array.len()); let num_labels = results - .component_batch_raw(&Text::name()) + .component_batch_raw_arrow2(&Text::name()) .map_or(0, |array| array.len()); ShowLabels::from(num_labels == 1 || num_instances < MAX_NUM_LABELS_PER_ENTITY) diff --git a/crates/viewer/re_viewer/src/blueprint/validation.rs b/crates/viewer/re_viewer/src/blueprint/validation.rs index 048c4569e2ec..4735289919f6 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation.rs @@ -24,7 +24,7 @@ pub(crate) fn validate_component(blueprint: &EntityDb) -> bool { if let Some(array) = engine .cache() .latest_at(&query, path, [C::name()]) - .component_batch_raw(&C::name()) + .component_batch_raw_arrow2(&C::name()) { if let Err(err) = C::from_arrow2_opt(&*array) { re_log::debug!( diff --git a/crates/viewer/re_viewer_context/src/blueprint_helpers.rs b/crates/viewer/re_viewer_context/src/blueprint_helpers.rs index c3912a3da785..bcf84dd327d8 100644 --- a/crates/viewer/re_viewer_context/src/blueprint_helpers.rs +++ b/crates/viewer/re_viewer_context/src/blueprint_helpers.rs @@ -1,5 +1,5 @@ use arrow::array::ArrayRef; -use re_chunk::{Arrow2Array, RowId}; +use re_chunk::RowId; use re_chunk_store::external::re_chunk::Chunk; use re_log_types::{EntityPath, TimeInt, TimePoint, Timeline}; use re_types::{AsComponents, ComponentBatch, ComponentDescriptor, ComponentName}; @@ -87,12 +87,12 @@ impl ViewerContext<'_> { &self, entity_path: &EntityPath, component_name: ComponentName, - array: Box, + array: ArrayRef, ) { let timepoint = self.store_context.blueprint_timepoint_for_writes(); let chunk = match Chunk::builder(entity_path.clone()) - .with_row( + .with_row_arrow1( RowId::new(), timepoint.clone(), [(ComponentDescriptor::new(component_name), array)], @@ -138,16 +138,6 @@ impl ViewerContext<'_> { }) } - /// Queries a raw component from the default blueprint. - pub fn raw_latest_at_in_default_blueprint_arrow2( - &self, - entity_path: &EntityPath, - component_name: ComponentName, - ) -> Option> { - self.raw_latest_at_in_default_blueprint(entity_path, component_name) - .map(|array| array.into()) - } - /// Resets a blueprint component to the value it had in the default blueprint. pub fn reset_blueprint_component_by_name( &self, @@ -155,7 +145,7 @@ impl ViewerContext<'_> { component_name: ComponentName, ) { if let Some(default_value) = - self.raw_latest_at_in_default_blueprint_arrow2(entity_path, component_name) + self.raw_latest_at_in_default_blueprint(entity_path, component_name) { self.save_blueprint_array(entity_path, component_name, default_value); } else { diff --git a/crates/viewer/re_viewer_context/src/component_ui_registry.rs b/crates/viewer/re_viewer_context/src/component_ui_registry.rs index 1e93023de52e..e04caa265280 100644 --- a/crates/viewer/re_viewer_context/src/component_ui_registry.rs +++ b/crates/viewer/re_viewer_context/src/component_ui_registry.rs @@ -1,14 +1,11 @@ use std::collections::BTreeMap; -use re_chunk::{Arrow2Array, RowId, UnitChunkShared}; +use re_chunk::{RowId, UnitChunkShared}; use re_chunk_store::LatestAtQuery; use re_entity_db::{EntityDb, EntityPath}; use re_log::ResultExt; use re_log_types::Instance; -use re_types::{ - external::arrow2::{self}, - ComponentName, -}; +use re_types::ComponentName; use re_ui::UiExt as _; use crate::{ComponentFallbackProvider, MaybeMutRef, QueryContext, ViewerContext}; @@ -174,7 +171,7 @@ type LegacyDisplayComponentUiCallback = Box< &EntityDb, &EntityPath, Option, - &dyn arrow2::array::Array, + &dyn arrow::array::Array, ) + Send + Sync, >; @@ -196,9 +193,9 @@ type UntypedComponentEditOrViewCallback = Box< dyn Fn( &ViewerContext<'_>, &mut egui::Ui, - &dyn arrow2::array::Array, + &dyn arrow::array::Array, EditOrView, - ) -> Option> + ) -> Option + Send + Sync, >; @@ -336,7 +333,7 @@ impl ComponentUiRegistry { if response.changed() { use re_types::LoggableBatch as _; - deserialized_value.to_arrow2().ok_or_log_error_once() + deserialized_value.to_arrow().ok_or_log_error_once() } else { None } @@ -391,7 +388,7 @@ impl ComponentUiRegistry { // Don't use component.raw_instance here since we want to handle the case where there's several // elements differently. // Also, it allows us to slice the array without cloning any elements. - let Some(array) = unit.component_batch_raw_arrow2(&component_name) else { + let Some(array) = unit.component_batch_raw(&component_name) else { re_log::error_once!("Couldn't get {component_name}: missing"); ui.error_with_details_on_hover(format!("Couldn't get {component_name}: missing")); return; @@ -413,7 +410,7 @@ impl ComponentUiRegistry { // Enforce clamp-to-border semantics. // TODO(andreas): Is that always what we want? let index = index.clamp(0, array.len().saturating_sub(1)); - let component_raw = array.sliced(index, 1); + let component_raw = array.slice(index, 1); self.ui_raw( ctx, @@ -440,7 +437,7 @@ impl ComponentUiRegistry { entity_path: &EntityPath, component_name: ComponentName, row_id: Option, - component_raw: &dyn arrow2::array::Array, + component_raw: &dyn arrow::array::Array, ) { re_tracing::profile_function!(component_name.full_name()); @@ -504,7 +501,7 @@ impl ComponentUiRegistry { blueprint_write_path: &EntityPath, component_name: ComponentName, row_id: Option, - component_array: Option<&dyn Arrow2Array>, + component_array: Option<&dyn arrow::array::Array>, fallback_provider: &dyn ComponentFallbackProvider, ) { let multiline = true; @@ -535,7 +532,7 @@ impl ComponentUiRegistry { blueprint_write_path: &EntityPath, component_name: ComponentName, row_id: Option, - component_query_result: Option<&dyn Arrow2Array>, + component_query_result: Option<&dyn arrow::array::Array>, fallback_provider: &dyn ComponentFallbackProvider, ) { let multiline = false; @@ -561,31 +558,32 @@ impl ComponentUiRegistry { blueprint_write_path: &EntityPath, component_name: ComponentName, row_id: Option, - component_array: Option<&dyn Arrow2Array>, + component_array: Option<&dyn arrow::array::Array>, fallback_provider: &dyn ComponentFallbackProvider, allow_multiline: bool, ) { re_tracing::profile_function!(component_name.full_name()); - // Use a fallback if there's either no component data at all or the component array is empty. - let component_raw = if let Some(component_raw) = - component_array.and_then(|array| (!array.is_empty()).then(|| array.to_boxed())) - { - component_raw - } else { - fallback_provider.fallback_for(ctx, component_name).into() + let mut run_with = |array| { + self.edit_ui_raw( + ctx, + ui, + origin_db, + blueprint_write_path, + component_name, + row_id, + array, + allow_multiline, + ); }; - self.edit_ui_raw( - ctx, - ui, - origin_db, - blueprint_write_path, - component_name, - row_id, - component_raw.as_ref(), - allow_multiline, - ); + // Use a fallback if there's either no component data at all or the component array is empty. + if let Some(component_array) = component_array.filter(|array| !array.is_empty()) { + run_with(component_array); + } else { + let fallback = fallback_provider.fallback_for(ctx, component_name); + run_with(fallback.as_ref()); + } } #[allow(clippy::too_many_arguments)] @@ -597,13 +595,13 @@ impl ComponentUiRegistry { blueprint_write_path: &EntityPath, component_name: ComponentName, row_id: Option, - component_raw: &dyn arrow2::array::Array, + component_raw: &dyn arrow::array::Array, allow_multiline: bool, ) { if !self.try_show_edit_ui( ctx.viewer_ctx, ui, - component_raw.as_ref(), + component_raw, blueprint_write_path, component_name, allow_multiline, @@ -631,7 +629,7 @@ impl ComponentUiRegistry { &self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, - raw_current_value: &dyn arrow2::array::Array, + raw_current_value: &dyn arrow::array::Array, blueprint_write_path: &EntityPath, component_name: ComponentName, allow_multiline: bool, @@ -660,9 +658,9 @@ impl ComponentUiRegistry { } } -fn try_deserialize(value: &dyn arrow2::array::Array) -> Option { +fn try_deserialize(value: &dyn arrow::array::Array) -> Option { let component_name = C::name(); - let deserialized = C::from_arrow2(value); + let deserialized = C::from_arrow(value); match deserialized { Ok(values) => { if values.len() > 1 { diff --git a/crates/viewer/re_viewer_context/src/item.rs b/crates/viewer/re_viewer_context/src/item.rs index 6dec4f817629..7b0ebb2646ef 100644 --- a/crates/viewer/re_viewer_context/src/item.rs +++ b/crates/viewer/re_viewer_context/src/item.rs @@ -211,7 +211,7 @@ pub fn resolve_mono_instance_path( &instance.entity_path, [ComponentDescriptor::new(component_name)], ) - .component_batch_raw(&component_name) + .component_batch_raw_arrow2(&component_name) { if array.len() > 1 { return instance.clone(); diff --git a/crates/viewer/re_viewer_context/src/view/view_context.rs b/crates/viewer/re_viewer_context/src/view/view_context.rs index 9f8104552328..be33c854ba4d 100644 --- a/crates/viewer/re_viewer_context/src/view/view_context.rs +++ b/crates/viewer/re_viewer_context/src/view/view_context.rs @@ -1,6 +1,5 @@ use std::sync::Arc; -use re_chunk::Arrow2Array; use re_chunk_store::LatestAtQuery; use re_log_types::{EntityPath, TimePoint}; use re_query::StorageEngineReadGuard; @@ -97,7 +96,7 @@ impl<'a> ViewContext<'a> { &self, entity_path: &EntityPath, component_name: ComponentName, - array: Box, + array: arrow::array::ArrayRef, ) { self.viewer_ctx .save_blueprint_array(entity_path, component_name, array); diff --git a/crates/viewer/re_viewport_blueprint/src/view.rs b/crates/viewer/re_viewport_blueprint/src/view.rs index 3177beae78da..44390a462fe6 100644 --- a/crates/viewer/re_viewport_blueprint/src/view.rs +++ b/crates/viewer/re_viewport_blueprint/src/view.rs @@ -263,7 +263,7 @@ impl ViewBlueprint { let array = blueprint_engine .cache() .latest_at(query, path, [component_name]) - .component_batch_raw(&component_name); + .component_batch_raw_arrow2(&component_name); array.map(|array| (ComponentDescriptor::new(component_name), array)) }), ) diff --git a/crates/viewer/re_viewport_blueprint/src/view_contents.rs b/crates/viewer/re_viewport_blueprint/src/view_contents.rs index 7988a7c9d65a..534cd3982c8f 100644 --- a/crates/viewer/re_viewport_blueprint/src/view_contents.rs +++ b/crates/viewer/re_viewport_blueprint/src/view_contents.rs @@ -491,7 +491,7 @@ impl DataQueryPropertyResolver<'_> { .storage_engine() .cache() .latest_at(blueprint_query, &recursive_override_path, [component_name]) - .component_batch_raw(&component_name) + .component_batch_raw_arrow2(&component_name) { if !component_data.is_empty() { recursive_property_overrides.to_mut().insert( @@ -522,7 +522,7 @@ impl DataQueryPropertyResolver<'_> { .storage_engine() .cache() .latest_at(blueprint_query, &individual_override_path, [component_name]) - .component_batch_raw(&component_name) + .component_batch_raw_arrow2(&component_name) { if !component_data.is_empty() { resolved_component_overrides.insert( diff --git a/examples/rust/extend_viewer_ui/src/main.rs b/examples/rust/extend_viewer_ui/src/main.rs index 76724ef27de2..073ec3e24e1e 100644 --- a/examples/rust/extend_viewer_ui/src/main.rs +++ b/examples/rust/extend_viewer_ui/src/main.rs @@ -163,7 +163,7 @@ fn component_ui( .cache() .latest_at(&query, entity_path, [component_name]); - if let Some(data) = results.component_batch_raw(&component_name) { + if let Some(data) = results.component_batch_raw_arrow2(&component_name) { egui::ScrollArea::vertical() .auto_shrink([false, true]) .show(ui, |ui| {