From c8855c7f42ea848034c012b87dd94bfffeae3424 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:07:48 +0200 Subject: [PATCH] Remove the `TimeRangeTableOrder` blueprint structure, which is no longer used by the dataframe view (#7415) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What - closes #7390 - related #7070 What the title says☝🏻 This was dead code and a wart in the dataframe view selection panel. Table sorting is now covered by #7070 and blocked on proper support at `re_dataframe` level. ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7415?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7415?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/7415) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. --- .../rerun/blueprint/archetypes.fbs | 1 - .../archetypes/time_range_table_order.fbs | 16 -- .../rerun/blueprint/components.fbs | 2 - .../rerun/blueprint/components/sort_key.fbs | 16 -- .../rerun/blueprint/components/sort_order.fbs | 16 -- .../src/blueprint/archetypes/.gitattributes | 1 - .../re_types/src/blueprint/archetypes/mod.rs | 2 - .../archetypes/time_range_table_order.rs | 204 ------------------ .../src/blueprint/components/.gitattributes | 2 - .../re_types/src/blueprint/components/mod.rs | 4 - .../src/blueprint/components/sort_key.rs | 150 ------------- .../src/blueprint/components/sort_order.rs | 150 ------------- crates/viewer/re_component_ui/src/lib.rs | 6 +- .../src/space_view_class.rs | 29 +-- .../src/blueprint/validation_gen/mod.rs | 4 - crates/viewer/re_viewer/src/reflection/mod.rs | 29 --- rerun_cpp/src/rerun/blueprint/archetypes.hpp | 1 - .../rerun/blueprint/archetypes/.gitattributes | 2 - .../archetypes/time_range_table_order.cpp | 39 ---- .../archetypes/time_range_table_order.hpp | 70 ------ rerun_cpp/src/rerun/blueprint/components.hpp | 2 - .../rerun/blueprint/components/.gitattributes | 4 - .../rerun/blueprint/components/sort_key.cpp | 58 ----- .../rerun/blueprint/components/sort_key.hpp | 57 ----- .../rerun/blueprint/components/sort_order.cpp | 58 ----- .../rerun/blueprint/components/sort_order.hpp | 57 ----- .../rerun/blueprint/archetypes/.gitattributes | 1 - .../rerun/blueprint/archetypes/__init__.py | 2 - .../archetypes/time_range_table_order.py | 82 ------- .../rerun/blueprint/components/.gitattributes | 2 - .../rerun/blueprint/components/__init__.py | 12 -- .../rerun/blueprint/components/sort_key.py | 75 ------- .../rerun/blueprint/components/sort_order.py | 75 ------- 33 files changed, 5 insertions(+), 1224 deletions(-) delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs delete mode 100644 crates/store/re_types/src/blueprint/archetypes/time_range_table_order.rs delete mode 100644 crates/store/re_types/src/blueprint/components/sort_key.rs delete mode 100644 crates/store/re_types/src/blueprint/components/sort_order.rs delete mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/sort_key.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/sort_key.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/sort_order.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/sort_order.hpp delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/time_range_table_order.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/sort_key.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/sort_order.py diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs index f6e6710b96b3..f1a11d176958 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes.fbs @@ -11,7 +11,6 @@ include "./archetypes/space_view_contents.fbs"; include "./archetypes/tensor_scalar_mapping.fbs"; include "./archetypes/tensor_slice_selection.fbs"; include "./archetypes/tensor_view_fit.fbs"; -include "./archetypes/time_range_table_order.fbs"; include "./archetypes/viewport_blueprint.fbs"; include "./archetypes/visible_time_ranges.fbs"; include "./archetypes/visual_bounds2d.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs deleted file mode 100644 index c7c8a6b771e1..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs +++ /dev/null @@ -1,16 +0,0 @@ -namespace rerun.blueprint.archetypes; - - -/// Ordering of the time range table of the dataframe view -table TimeRangeTableOrder ( - "attr.rerun.scope": "blueprint", - "attr.rust.derive": "Copy" -) { - // --- Optional --- - - /// The primary sort key - sort_key: rerun.blueprint.components.SortKey ("attr.rerun.component_optional", nullable, order: 2000); - - /// The sort order - sort_order: rerun.blueprint.components.SortOrder ("attr.rerun.component_optional", nullable, order: 3000); -} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components.fbs b/crates/store/re_types/definitions/rerun/blueprint/components.fbs index 95262a56a7e0..035b81c4a7b6 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components.fbs @@ -18,8 +18,6 @@ include "./components/query_expression.fbs"; include "./components/query_kind.fbs"; include "./components/root_container.fbs"; include "./components/row_share.fbs"; -include "./components/sort_key.fbs"; -include "./components/sort_order.fbs"; include "./components/space_view_class.fbs"; include "./components/space_view_maximized.fbs"; include "./components/space_view_origin.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs deleted file mode 100644 index df3acba67c26..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs +++ /dev/null @@ -1,16 +0,0 @@ -namespace rerun.blueprint.components; - - -/// Primary element by which to group by in a temporal data table. -enum SortKey: ubyte ( - "attr.rerun.scope": "blueprint" -) { - /// Invalid value. Won't show up in generated types. - Invalid = 0, - - /// Group by entity. - Entity (default), - - /// Group by instance. - Time, -} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs deleted file mode 100644 index 99e08febfe43..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs +++ /dev/null @@ -1,16 +0,0 @@ -namespace rerun.blueprint.components; - - -/// Sort order for data table. -enum SortOrder: ubyte ( - "attr.rerun.scope": "blueprint" -) { - /// Invalid value. Won't show up in generated types. - Invalid = 0, - - /// Ascending - Ascending (default), - - /// Descending - Descending, -} diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index 51fc7263ee37..8275cbf12a81 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -11,6 +11,5 @@ space_view_contents.rs linguist-generated=true tensor_scalar_mapping.rs linguist-generated=true tensor_slice_selection.rs linguist-generated=true tensor_view_fit.rs linguist-generated=true -time_range_table_order.rs linguist-generated=true visible_time_ranges.rs linguist-generated=true visual_bounds2d.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index e0616353c032..19f7dfedff0c 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -9,7 +9,6 @@ mod space_view_contents; mod tensor_scalar_mapping; mod tensor_slice_selection; mod tensor_view_fit; -mod time_range_table_order; mod visible_time_ranges; mod visible_time_ranges_ext; mod visual_bounds2d; @@ -23,6 +22,5 @@ pub use self::space_view_contents::SpaceViewContents; pub use self::tensor_scalar_mapping::TensorScalarMapping; pub use self::tensor_slice_selection::TensorSliceSelection; pub use self::tensor_view_fit::TensorViewFit; -pub use self::time_range_table_order::TimeRangeTableOrder; pub use self::visible_time_ranges::VisibleTimeRanges; pub use self::visual_bounds2d::VisualBounds2D; diff --git a/crates/store/re_types/src/blueprint/archetypes/time_range_table_order.rs b/crates/store/re_types/src/blueprint/archetypes/time_range_table_order.rs deleted file mode 100644 index 2d3693b18997..000000000000 --- a/crates/store/re_types/src/blueprint/archetypes/time_range_table_order.rs +++ /dev/null @@ -1,204 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs". - -#![allow(unused_imports)] -#![allow(unused_parens)] -#![allow(clippy::clone_on_copy)] -#![allow(clippy::cloned_instead_of_copied)] -#![allow(clippy::map_flatten)] -#![allow(clippy::needless_question_mark)] -#![allow(clippy::new_without_default)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::too_many_arguments)] -#![allow(clippy::too_many_lines)] - -use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; -use ::re_types_core::SerializationResult; -use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; -use ::re_types_core::{DeserializationError, DeserializationResult}; - -/// **Archetype**: Ordering of the time range table of the dataframe view -#[derive(Clone, Debug, Copy)] -pub struct TimeRangeTableOrder { - /// The primary sort key - pub sort_key: Option, - - /// The sort order - pub sort_order: Option, -} - -impl ::re_types_core::SizeBytes for TimeRangeTableOrder { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.sort_key.heap_size_bytes() + self.sort_order.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - } -} - -static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = - once_cell::sync::Lazy::new(|| []); - -static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = - once_cell::sync::Lazy::new(|| { - ["rerun.blueprint.components.TimeRangeTableOrderIndicator".into()] - }); - -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.SortKey".into(), - "rerun.blueprint.components.SortOrder".into(), - ] - }); - -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.TimeRangeTableOrderIndicator".into(), - "rerun.blueprint.components.SortKey".into(), - "rerun.blueprint.components.SortOrder".into(), - ] - }); - -impl TimeRangeTableOrder { - /// The total number of components in the archetype: 0 required, 1 recommended, 2 optional - pub const NUM_COMPONENTS: usize = 3usize; -} - -/// Indicator component for the [`TimeRangeTableOrder`] [`::re_types_core::Archetype`] -pub type TimeRangeTableOrderIndicator = - ::re_types_core::GenericIndicatorComponent; - -impl ::re_types_core::Archetype for TimeRangeTableOrder { - type Indicator = TimeRangeTableOrderIndicator; - - #[inline] - fn name() -> ::re_types_core::ArchetypeName { - "rerun.blueprint.archetypes.TimeRangeTableOrder".into() - } - - #[inline] - fn display_name() -> &'static str { - "Time range table order" - } - - #[inline] - fn indicator() -> MaybeOwnedComponentBatch<'static> { - static INDICATOR: TimeRangeTableOrderIndicator = TimeRangeTableOrderIndicator::DEFAULT; - MaybeOwnedComponentBatch::Ref(&INDICATOR) - } - - #[inline] - fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> { - REQUIRED_COMPONENTS.as_slice().into() - } - - #[inline] - fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> { - RECOMMENDED_COMPONENTS.as_slice().into() - } - - #[inline] - fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> { - OPTIONAL_COMPONENTS.as_slice().into() - } - - #[inline] - fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> { - ALL_COMPONENTS.as_slice().into() - } - - #[inline] - fn from_arrow_components( - arrow_data: impl IntoIterator)>, - ) -> DeserializationResult { - re_tracing::profile_function!(); - use ::re_types_core::{Loggable as _, ResultExt as _}; - let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data - .into_iter() - .map(|(name, array)| (name.full_name(), array)) - .collect(); - let sort_key = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.SortKey") - { - ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.TimeRangeTableOrder#sort_key")? - .into_iter() - .next() - .flatten() - } else { - None - }; - let sort_order = - if let Some(array) = arrays_by_name.get("rerun.blueprint.components.SortOrder") { - ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.TimeRangeTableOrder#sort_order")? - .into_iter() - .next() - .flatten() - } else { - None - }; - Ok(Self { - sort_key, - sort_order, - }) - } -} - -impl ::re_types_core::AsComponents for TimeRangeTableOrder { - fn as_component_batches(&self) -> Vec> { - re_tracing::profile_function!(); - use ::re_types_core::Archetype as _; - [ - Some(Self::indicator()), - self.sort_key - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.sort_order - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - ] - .into_iter() - .flatten() - .collect() - } -} - -impl ::re_types_core::ArchetypeReflectionMarker for TimeRangeTableOrder {} - -impl TimeRangeTableOrder { - /// Create a new `TimeRangeTableOrder`. - #[inline] - pub fn new() -> Self { - Self { - sort_key: None, - sort_order: None, - } - } - - /// The primary sort key - #[inline] - pub fn with_sort_key( - mut self, - sort_key: impl Into, - ) -> Self { - self.sort_key = Some(sort_key.into()); - self - } - - /// The sort order - #[inline] - pub fn with_sort_order( - mut self, - sort_order: impl Into, - ) -> Self { - self.sort_order = Some(sort_order.into()); - self - } -} diff --git a/crates/store/re_types/src/blueprint/components/.gitattributes b/crates/store/re_types/src/blueprint/components/.gitattributes index 93f783652817..09201cfd9152 100644 --- a/crates/store/re_types/src/blueprint/components/.gitattributes +++ b/crates/store/re_types/src/blueprint/components/.gitattributes @@ -14,8 +14,6 @@ panel_state.rs linguist-generated=true query_expression.rs linguist-generated=true query_kind.rs linguist-generated=true row_share.rs linguist-generated=true -sort_key.rs linguist-generated=true -sort_order.rs linguist-generated=true space_view_class.rs linguist-generated=true space_view_origin.rs linguist-generated=true tensor_dimension_index_slider.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/components/mod.rs b/crates/store/re_types/src/blueprint/components/mod.rs index a54028c22654..e371fca4c9e5 100644 --- a/crates/store/re_types/src/blueprint/components/mod.rs +++ b/crates/store/re_types/src/blueprint/components/mod.rs @@ -16,8 +16,6 @@ mod panel_state_ext; mod query_expression; mod query_kind; mod row_share; -mod sort_key; -mod sort_order; mod space_view_class; mod space_view_class_ext; mod space_view_origin; @@ -49,8 +47,6 @@ pub use self::panel_state::PanelState; pub use self::query_expression::QueryExpression; pub use self::query_kind::QueryKind; pub use self::row_share::RowShare; -pub use self::sort_key::SortKey; -pub use self::sort_order::SortOrder; pub use self::space_view_class::SpaceViewClass; pub use self::space_view_origin::SpaceViewOrigin; pub use self::tensor_dimension_index_slider::TensorDimensionIndexSlider; diff --git a/crates/store/re_types/src/blueprint/components/sort_key.rs b/crates/store/re_types/src/blueprint/components/sort_key.rs deleted file mode 100644 index 99e05a181424..000000000000 --- a/crates/store/re_types/src/blueprint/components/sort_key.rs +++ /dev/null @@ -1,150 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs". - -#![allow(unused_imports)] -#![allow(unused_parens)] -#![allow(clippy::clone_on_copy)] -#![allow(clippy::cloned_instead_of_copied)] -#![allow(clippy::map_flatten)] -#![allow(clippy::needless_question_mark)] -#![allow(clippy::new_without_default)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::too_many_arguments)] -#![allow(clippy::too_many_lines)] - -use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; -use ::re_types_core::SerializationResult; -use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; -use ::re_types_core::{DeserializationError, DeserializationResult}; - -/// **Component**: Primary element by which to group by in a temporal data table. -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Default)] -#[repr(u8)] -pub enum SortKey { - /// Group by entity. - #[default] - Entity = 1, - - /// Group by instance. - Time = 2, -} - -impl ::re_types_core::reflection::Enum for SortKey { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Entity, Self::Time] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Entity => "Group by entity.", - Self::Time => "Group by instance.", - } - } -} - -impl ::re_types_core::SizeBytes for SortKey { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for SortKey { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Entity => write!(f, "Entity"), - Self::Time => write!(f, "Time"), - } - } -} - -::re_types_core::macros::impl_into_cow!(SortKey); - -impl ::re_types_core::Loggable for SortKey { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.components.SortKey".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::UInt8 - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data0): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - let datum = datum.map(|datum| *datum as u8); - (datum.is_some(), datum) - }) - .unzip(); - let data0_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - PrimitiveArray::new( - Self::arrow_datatype(), - data0.into_iter().map(|v| v.unwrap_or_default()).collect(), - data0_bitmap, - ) - .boxed() - }) - } - - fn from_arrow_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - #![allow(clippy::wildcard_imports)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; - Ok(arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = Self::arrow_datatype(); - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.components.SortKey#enum")? - .into_iter() - .map(|opt| opt.copied()) - .map(|typ| match typ { - Some(1) => Ok(Some(Self::Entity)), - Some(2) => Ok(Some(Self::Time)), - None => Ok(None), - Some(invalid) => Err(DeserializationError::missing_union_arm( - Self::arrow_datatype(), - "", - invalid as _, - )), - }) - .collect::>>>() - .with_context("rerun.blueprint.components.SortKey")?) - } -} diff --git a/crates/store/re_types/src/blueprint/components/sort_order.rs b/crates/store/re_types/src/blueprint/components/sort_order.rs deleted file mode 100644 index 62f0a44a8e5a..000000000000 --- a/crates/store/re_types/src/blueprint/components/sort_order.rs +++ /dev/null @@ -1,150 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs". - -#![allow(unused_imports)] -#![allow(unused_parens)] -#![allow(clippy::clone_on_copy)] -#![allow(clippy::cloned_instead_of_copied)] -#![allow(clippy::map_flatten)] -#![allow(clippy::needless_question_mark)] -#![allow(clippy::new_without_default)] -#![allow(clippy::redundant_closure)] -#![allow(clippy::too_many_arguments)] -#![allow(clippy::too_many_lines)] - -use ::re_types_core::external::arrow2; -use ::re_types_core::ComponentName; -use ::re_types_core::SerializationResult; -use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; -use ::re_types_core::{DeserializationError, DeserializationResult}; - -/// **Component**: Sort order for data table. -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Default)] -#[repr(u8)] -pub enum SortOrder { - /// Ascending - #[default] - Ascending = 1, - - /// Descending - Descending = 2, -} - -impl ::re_types_core::reflection::Enum for SortOrder { - #[inline] - fn variants() -> &'static [Self] { - &[Self::Ascending, Self::Descending] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::Ascending => "Ascending", - Self::Descending => "Descending", - } - } -} - -impl ::re_types_core::SizeBytes for SortOrder { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for SortOrder { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Ascending => write!(f, "Ascending"), - Self::Descending => write!(f, "Descending"), - } - } -} - -::re_types_core::macros::impl_into_cow!(SortOrder); - -impl ::re_types_core::Loggable for SortOrder { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.components.SortOrder".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::UInt8 - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data0): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - let datum = datum.map(|datum| *datum as u8); - (datum.is_some(), datum) - }) - .unzip(); - let data0_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - PrimitiveArray::new( - Self::arrow_datatype(), - data0.into_iter().map(|v| v.unwrap_or_default()).collect(), - data0_bitmap, - ) - .boxed() - }) - } - - fn from_arrow_opt( - arrow_data: &dyn arrow2::array::Array, - ) -> DeserializationResult>> - where - Self: Sized, - { - #![allow(clippy::wildcard_imports)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, buffer::*, datatypes::*}; - Ok(arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = Self::arrow_datatype(); - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.components.SortOrder#enum")? - .into_iter() - .map(|opt| opt.copied()) - .map(|typ| match typ { - Some(1) => Ok(Some(Self::Ascending)), - Some(2) => Ok(Some(Self::Descending)), - None => Ok(None), - Some(invalid) => Err(DeserializationError::missing_union_arm( - Self::arrow_datatype(), - "", - invalid as _, - )), - }) - .collect::>>>() - .with_context("rerun.blueprint.components.SortOrder")?) - } -} diff --git a/crates/viewer/re_component_ui/src/lib.rs b/crates/viewer/re_component_ui/src/lib.rs index 33c72fbdd9e3..7704c0e9b554 100644 --- a/crates/viewer/re_component_ui/src/lib.rs +++ b/crates/viewer/re_component_ui/src/lib.rs @@ -26,9 +26,7 @@ use datatype_uis::{ }; use re_types::{ - blueprint::components::{ - BackgroundKind, Corner2D, LockRangeDuringZoom, SortKey, SortOrder, ViewFit, Visible, - }, + blueprint::components::{BackgroundKind, Corner2D, LockRangeDuringZoom, ViewFit, Visible}, components::{ AggregationPolicy, AlbedoFactor, AxisLength, Color, DepthMeter, DrawOrder, FillMode, FillRatio, GammaCorrection, ImagePlaneDistance, MagnificationFilter, MarkerSize, Name, @@ -91,8 +89,6 @@ pub fn create_component_ui_registry() -> re_viewer_context::ComponentUiRegistry registry.add_singleline_edit_or_view::(edit_view_enum); registry.add_singleline_edit_or_view::(edit_view_enum); registry.add_singleline_edit_or_view::(edit_view_enum); - registry.add_singleline_edit_or_view::(edit_view_enum); - registry.add_singleline_edit_or_view::(edit_view_enum); registry.add_singleline_edit_or_view::(edit_view_enum); registry.add_singleline_edit_or_view::(edit_view_enum); diff --git a/crates/viewer/re_space_view_dataframe/src/space_view_class.rs b/crates/viewer/re_space_view_dataframe/src/space_view_class.rs index 4679c3bc18bb..9e1c9dacb402 100644 --- a/crates/viewer/re_space_view_dataframe/src/space_view_class.rs +++ b/crates/viewer/re_space_view_dataframe/src/space_view_class.rs @@ -1,18 +1,16 @@ use egui::Ui; -use crate::dataframe_ui::dataframe_ui; -use crate::{query_kind::QueryKind, view_query::Query, visualizer_system::EmptySystem}; use re_log_types::{EntityPath, EntityPathFilter, ResolvedTimeRange}; -use re_space_view::view_property_ui; -use re_types::blueprint::archetypes; use re_types_core::SpaceViewClassIdentifier; -use re_ui::list_item; use re_viewer_context::{ SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId, SpaceViewState, SpaceViewSystemExecutionError, SystemExecutionOutput, ViewQuery, ViewerContext, }; use re_viewport_blueprint::SpaceViewContents; +use crate::dataframe_ui::dataframe_ui; +use crate::{query_kind::QueryKind, visualizer_system::EmptySystem}; + #[derive(Default)] pub struct DataframeSpaceView; @@ -86,26 +84,7 @@ mode sets the default time range to _everything_. You can override this in the s _space_origin: &EntityPath, space_view_id: SpaceViewId, ) -> Result<(), SpaceViewSystemExecutionError> { - crate::view_query::query_ui(ctx, ui, state, space_view_id)?; - - list_item::list_item_scope(ui, "dataframe_view_selection_ui", |ui| { - let view_query = Query::try_from_blueprint(ctx, space_view_id)?; - //TODO(#7070): column order and sorting needs much love - ui.add_enabled_ui( - matches!(view_query.kind(ctx), QueryKind::Range { .. }), - |ui| { - view_property_ui::( - ctx, - ui, - space_view_id, - self, - state, - ); - }, - ); - - Ok(()) - }) + crate::view_query::query_ui(ctx, ui, state, space_view_id) } fn ui( diff --git a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs index 4dd334f2c5a7..1a0d2ece893e 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs @@ -13,8 +13,6 @@ pub use re_types::blueprint::components::PanelState; pub use re_types::blueprint::components::QueryExpression; pub use re_types::blueprint::components::QueryKind; pub use re_types::blueprint::components::RowShare; -pub use re_types::blueprint::components::SortKey; -pub use re_types::blueprint::components::SortOrder; pub use re_types::blueprint::components::SpaceViewClass; pub use re_types::blueprint::components::SpaceViewOrigin; pub use re_types::blueprint::components::TensorDimensionIndexSlider; @@ -56,8 +54,6 @@ pub fn is_valid_blueprint(blueprint: &EntityDb) -> bool { && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) - && validate_component::(blueprint) - && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index a9d93ea9f5a7..666d9d36560a 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -160,20 +160,6 @@ fn generate_component_reflection() -> Result::name(), - ComponentReflection { - docstring_md: "Primary element by which to group by in a temporal data table.", - placeholder: Some(SortKey::default().to_arrow()?), - }, - ), - ( - ::name(), - ComponentReflection { - docstring_md: "Sort order for data table.", - placeholder: Some(SortOrder::default().to_arrow()?), - }, - ), ( ::name(), ComponentReflection { @@ -1703,21 +1689,6 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ], }, ), - ( - ArchetypeName::new("rerun.blueprint.archetypes.TimeRangeTableOrder"), - ArchetypeReflection { - display_name: "Time range table order", - fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.SortKey".into(), display_name : - "Sort key", docstring_md : "The primary sort key", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.SortOrder".into(), display_name : - "Sort order", docstring_md : "The sort order", is_required : false, - }, - ], - }, - ), ( ArchetypeName::new("rerun.blueprint.archetypes.ViewportBlueprint"), ArchetypeReflection { diff --git a/rerun_cpp/src/rerun/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/archetypes.hpp index 39a6b0f8053b..eae71f6b2164 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -13,7 +13,6 @@ #include "blueprint/archetypes/tensor_scalar_mapping.hpp" #include "blueprint/archetypes/tensor_slice_selection.hpp" #include "blueprint/archetypes/tensor_view_fit.hpp" -#include "blueprint/archetypes/time_range_table_order.hpp" #include "blueprint/archetypes/viewport_blueprint.hpp" #include "blueprint/archetypes/visible_time_ranges.hpp" #include "blueprint/archetypes/visual_bounds2d.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes index eae6a969df5b..40240eeaa29b 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -23,8 +23,6 @@ tensor_slice_selection.cpp linguist-generated=true tensor_slice_selection.hpp linguist-generated=true tensor_view_fit.cpp linguist-generated=true tensor_view_fit.hpp linguist-generated=true -time_range_table_order.cpp linguist-generated=true -time_range_table_order.hpp linguist-generated=true viewport_blueprint.cpp linguist-generated=true viewport_blueprint.hpp linguist-generated=true visible_time_ranges.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.cpp deleted file mode 100644 index 09f248ebe073..000000000000 --- a/rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs". - -#include "time_range_table_order.hpp" - -#include "../../collection_adapter_builtins.hpp" - -namespace rerun::blueprint::archetypes {} - -namespace rerun { - - Result> - AsComponents::serialize( - const blueprint::archetypes::TimeRangeTableOrder& archetype - ) { - using namespace blueprint::archetypes; - std::vector cells; - cells.reserve(3); - - if (archetype.sort_key.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.sort_key.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.sort_order.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.sort_order.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - { - auto indicator = TimeRangeTableOrder::IndicatorComponent(); - auto result = ComponentBatch::from_loggable(indicator); - RR_RETURN_NOT_OK(result.error); - cells.emplace_back(std::move(result.value)); - } - - return cells; - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.hpp deleted file mode 100644 index 99fc95b46a60..000000000000 --- a/rerun_cpp/src/rerun/blueprint/archetypes/time_range_table_order.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs". - -#pragma once - -#include "../../blueprint/components/sort_key.hpp" -#include "../../blueprint/components/sort_order.hpp" -#include "../../collection.hpp" -#include "../../compiler_utils.hpp" -#include "../../component_batch.hpp" -#include "../../indicator_component.hpp" -#include "../../result.hpp" - -#include -#include -#include -#include - -namespace rerun::blueprint::archetypes { - /// **Archetype**: Ordering of the time range table of the dataframe view - struct TimeRangeTableOrder { - /// The primary sort key - std::optional sort_key; - - /// The sort order - std::optional sort_order; - - public: - static constexpr const char IndicatorComponentName[] = - "rerun.blueprint.components.TimeRangeTableOrderIndicator"; - - /// Indicator component, used to identify the archetype when converting to a list of components. - using IndicatorComponent = rerun::components::IndicatorComponent; - - public: - TimeRangeTableOrder() = default; - TimeRangeTableOrder(TimeRangeTableOrder&& other) = default; - - /// The primary sort key - TimeRangeTableOrder with_sort_key(rerun::blueprint::components::SortKey _sort_key) && { - sort_key = std::move(_sort_key); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// The sort order - TimeRangeTableOrder with_sort_order(rerun::blueprint::components::SortOrder _sort_order - ) && { - sort_order = std::move(_sort_order); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - }; - -} // namespace rerun::blueprint::archetypes - -namespace rerun { - /// \private - template - struct AsComponents; - - /// \private - template <> - struct AsComponents { - /// Serialize all set component batches. - static Result> serialize( - const blueprint::archetypes::TimeRangeTableOrder& archetype - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/components.hpp index 19657a843547..648fccbf658c 100644 --- a/rerun_cpp/src/rerun/blueprint/components.hpp +++ b/rerun_cpp/src/rerun/blueprint/components.hpp @@ -20,8 +20,6 @@ #include "blueprint/components/query_kind.hpp" #include "blueprint/components/root_container.hpp" #include "blueprint/components/row_share.hpp" -#include "blueprint/components/sort_key.hpp" -#include "blueprint/components/sort_order.hpp" #include "blueprint/components/space_view_class.hpp" #include "blueprint/components/space_view_maximized.hpp" #include "blueprint/components/space_view_origin.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components/.gitattributes b/rerun_cpp/src/rerun/blueprint/components/.gitattributes index 96df82b452ea..b35efe878717 100644 --- a/rerun_cpp/src/rerun/blueprint/components/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/components/.gitattributes @@ -25,10 +25,6 @@ query_kind.cpp linguist-generated=true query_kind.hpp linguist-generated=true root_container.hpp linguist-generated=true row_share.hpp linguist-generated=true -sort_key.cpp linguist-generated=true -sort_key.hpp linguist-generated=true -sort_order.cpp linguist-generated=true -sort_order.hpp linguist-generated=true space_view_class.hpp linguist-generated=true space_view_maximized.hpp linguist-generated=true space_view_origin.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/components/sort_key.cpp b/rerun_cpp/src/rerun/blueprint/components/sort_key.cpp deleted file mode 100644 index 02229a34e398..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/sort_key.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs". - -#include "sort_key.hpp" - -#include -#include - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::uint8(); - return datatype; - } - - Result> Loggable::to_arrow( - const blueprint::components::SortKey* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::UInt8Builder* builder, const blueprint::components::SortKey* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto variant = elements[elem_idx]; - ARROW_RETURN_NOT_OK(builder->Append(static_cast(variant))); - } - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/sort_key.hpp b/rerun_cpp/src/rerun/blueprint/components/sort_key.hpp deleted file mode 100644 index c9d97d46606e..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/sort_key.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs". - -#pragma once - -#include "../../result.hpp" - -#include -#include - -namespace arrow { - /// \private - template - class NumericBuilder; - - class Array; - class DataType; - class UInt8Type; - using UInt8Builder = NumericBuilder; -} // namespace arrow - -namespace rerun::blueprint::components { - /// **Component**: Primary element by which to group by in a temporal data table. - enum class SortKey : uint8_t { - - /// Group by entity. - Entity = 1, - - /// Group by instance. - Time = 2, - }; -} // namespace rerun::blueprint::components - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.components.SortKey"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: components::SortKey` into an arrow array. - static Result> to_arrow( - const blueprint::components::SortKey* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::UInt8Builder* builder, const blueprint::components::SortKey* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/sort_order.cpp b/rerun_cpp/src/rerun/blueprint/components/sort_order.cpp deleted file mode 100644 index f221abafb0ec..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/sort_order.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs". - -#include "sort_order.hpp" - -#include -#include - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::uint8(); - return datatype; - } - - Result> Loggable::to_arrow( - const blueprint::components::SortOrder* instances, size_t num_instances - ) { - // TODO(andreas): Allow configuring the memory pool. - arrow::MemoryPool* pool = arrow::default_memory_pool(); - auto datatype = arrow_datatype(); - - ARROW_ASSIGN_OR_RAISE(auto builder, arrow::MakeBuilder(datatype, pool)) - if (instances && num_instances > 0) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - static_cast(builder.get()), - instances, - num_instances - )); - } - std::shared_ptr array; - ARROW_RETURN_NOT_OK(builder->Finish(&array)); - return array; - } - - rerun::Error Loggable::fill_arrow_array_builder( - arrow::UInt8Builder* builder, const blueprint::components::SortOrder* elements, - size_t num_elements - ) { - if (builder == nullptr) { - return rerun::Error(ErrorCode::UnexpectedNullArgument, "Passed array builder is null."); - } - if (elements == nullptr) { - return rerun::Error( - ErrorCode::UnexpectedNullArgument, - "Cannot serialize null pointer to arrow array." - ); - } - - ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto variant = elements[elem_idx]; - ARROW_RETURN_NOT_OK(builder->Append(static_cast(variant))); - } - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/sort_order.hpp b/rerun_cpp/src/rerun/blueprint/components/sort_order.hpp deleted file mode 100644 index 275093f3c933..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/sort_order.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs -// Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs". - -#pragma once - -#include "../../result.hpp" - -#include -#include - -namespace arrow { - /// \private - template - class NumericBuilder; - - class Array; - class DataType; - class UInt8Type; - using UInt8Builder = NumericBuilder; -} // namespace arrow - -namespace rerun::blueprint::components { - /// **Component**: Sort order for data table. - enum class SortOrder : uint8_t { - - /// Ascending - Ascending = 1, - - /// Descending - Descending = 2, - }; -} // namespace rerun::blueprint::components - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.components.SortOrder"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: components::SortOrder` into an arrow array. - static Result> to_arrow( - const blueprint::components::SortOrder* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::UInt8Builder* builder, const blueprint::components::SortOrder* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes index 58d01529a89b..1db9a825f2e9 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -13,7 +13,6 @@ space_view_contents.py linguist-generated=true tensor_scalar_mapping.py linguist-generated=true tensor_slice_selection.py linguist-generated=true tensor_view_fit.py linguist-generated=true -time_range_table_order.py linguist-generated=true viewport_blueprint.py linguist-generated=true visible_time_ranges.py linguist-generated=true visual_bounds2d.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py index c07e1563847d..423f025dc7aa 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -13,7 +13,6 @@ from .tensor_scalar_mapping import TensorScalarMapping from .tensor_slice_selection import TensorSliceSelection from .tensor_view_fit import TensorViewFit -from .time_range_table_order import TimeRangeTableOrder from .viewport_blueprint import ViewportBlueprint from .visible_time_ranges import VisibleTimeRanges from .visual_bounds2d import VisualBounds2D @@ -30,7 +29,6 @@ "TensorScalarMapping", "TensorSliceSelection", "TensorViewFit", - "TimeRangeTableOrder", "ViewportBlueprint", "VisibleTimeRanges", "VisualBounds2D", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/time_range_table_order.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/time_range_table_order.py deleted file mode 100644 index 57ad298e82be..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/time_range_table_order.py +++ /dev/null @@ -1,82 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/time_range_table_order.fbs". - -# You can extend this class by creating a "TimeRangeTableOrderExt" class in "time_range_table_order_ext.py". - -from __future__ import annotations - -from typing import Any - -from attrs import define, field - -from ..._baseclasses import ( - Archetype, -) -from ...blueprint import components as blueprint_components -from ...error_utils import catch_and_log_exceptions - -__all__ = ["TimeRangeTableOrder"] - - -@define(str=False, repr=False, init=False) -class TimeRangeTableOrder(Archetype): - """**Archetype**: Ordering of the time range table of the dataframe view.""" - - def __init__( - self: Any, - *, - sort_key: blueprint_components.SortKeyLike | None = None, - sort_order: blueprint_components.SortOrderLike | None = None, - ): - """ - Create a new instance of the TimeRangeTableOrder archetype. - - Parameters - ---------- - sort_key: - The primary sort key - sort_order: - The sort order - - """ - - # You can define your own __init__ function as a member of TimeRangeTableOrderExt in time_range_table_order_ext.py - with catch_and_log_exceptions(context=self.__class__.__name__): - self.__attrs_init__(sort_key=sort_key, sort_order=sort_order) - return - self.__attrs_clear__() - - def __attrs_clear__(self) -> None: - """Convenience method for calling `__attrs_init__` with all `None`s.""" - self.__attrs_init__( - sort_key=None, # type: ignore[arg-type] - sort_order=None, # type: ignore[arg-type] - ) - - @classmethod - def _clear(cls) -> TimeRangeTableOrder: - """Produce an empty TimeRangeTableOrder, bypassing `__init__`.""" - inst = cls.__new__(cls) - inst.__attrs_clear__() - return inst - - sort_key: blueprint_components.SortKeyBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.SortKeyBatch._optional, # type: ignore[misc] - ) - # The primary sort key - # - # (Docstring intentionally commented out to hide this field from the docs) - - sort_order: blueprint_components.SortOrderBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.SortOrderBatch._optional, # type: ignore[misc] - ) - # The sort order - # - # (Docstring intentionally commented out to hide this field from the docs) - - __str__ = Archetype.__str__ - __repr__ = Archetype.__repr__ # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes index 201c9647727e..cfd7b1d54f2e 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes @@ -20,8 +20,6 @@ query_expression.py linguist-generated=true query_kind.py linguist-generated=true root_container.py linguist-generated=true row_share.py linguist-generated=true -sort_key.py linguist-generated=true -sort_order.py linguist-generated=true space_view_class.py linguist-generated=true space_view_maximized.py linguist-generated=true space_view_origin.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py index 672894030dcb..b1630686b28d 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -38,8 +38,6 @@ from .query_kind import QueryKind, QueryKindArrayLike, QueryKindBatch, QueryKindLike, QueryKindType from .root_container import RootContainer, RootContainerBatch, RootContainerType from .row_share import RowShare, RowShareBatch, RowShareType -from .sort_key import SortKey, SortKeyArrayLike, SortKeyBatch, SortKeyLike, SortKeyType -from .sort_order import SortOrder, SortOrderArrayLike, SortOrderBatch, SortOrderLike, SortOrderType from .space_view_class import SpaceViewClass, SpaceViewClassBatch, SpaceViewClassType from .space_view_maximized import SpaceViewMaximized, SpaceViewMaximizedBatch, SpaceViewMaximizedType from .space_view_origin import SpaceViewOrigin, SpaceViewOriginBatch, SpaceViewOriginType @@ -134,16 +132,6 @@ "RowShare", "RowShareBatch", "RowShareType", - "SortKey", - "SortKeyArrayLike", - "SortKeyBatch", - "SortKeyLike", - "SortKeyType", - "SortOrder", - "SortOrderArrayLike", - "SortOrderBatch", - "SortOrderLike", - "SortOrderType", "SpaceViewClass", "SpaceViewClassBatch", "SpaceViewClassType", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/sort_key.py b/rerun_py/rerun_sdk/rerun/blueprint/components/sort_key.py deleted file mode 100644 index d4ae1508d4a7..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/sort_key.py +++ /dev/null @@ -1,75 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_key.fbs". - -# You can extend this class by creating a "SortKeyExt" class in "sort_key_ext.py". - -from __future__ import annotations - -from typing import Literal, Sequence, Union - -import pyarrow as pa - -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, - ComponentBatchMixin, -) - -__all__ = ["SortKey", "SortKeyArrayLike", "SortKeyBatch", "SortKeyLike", "SortKeyType"] - - -from enum import Enum - - -class SortKey(Enum): - """**Component**: Primary element by which to group by in a temporal data table.""" - - Entity = 1 - """Group by entity.""" - - Time = 2 - """Group by instance.""" - - @classmethod - def auto(cls, val: str | int | SortKey) -> SortKey: - """Best-effort converter, including a case-insensitive string matcher.""" - if isinstance(val, SortKey): - return val - if isinstance(val, int): - return cls(val) - try: - return cls[val] - except KeyError: - val_lower = val.lower() - for variant in cls: - if variant.name.lower() == val_lower: - return variant - raise ValueError(f"Cannot convert {val} to {cls.__name__}") - - def __str__(self) -> str: - """Returns the variant name.""" - return self.name - - -SortKeyLike = Union[SortKey, Literal["Entity", "Time", "entity", "time"], int] -SortKeyArrayLike = Union[SortKeyLike, Sequence[SortKeyLike]] - - -class SortKeyType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.components.SortKey" - - def __init__(self) -> None: - pa.ExtensionType.__init__(self, pa.uint8(), self._TYPE_NAME) - - -class SortKeyBatch(BaseBatch[SortKeyArrayLike], ComponentBatchMixin): - _ARROW_TYPE = SortKeyType() - - @staticmethod - def _native_to_pa_array(data: SortKeyArrayLike, data_type: pa.DataType) -> pa.Array: - if isinstance(data, (SortKey, int, str)): - data = [data] - - pa_data = [SortKey.auto(v).value if v is not None else None for v in data] # type: ignore[redundant-expr] - - return pa.array(pa_data, type=data_type) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/sort_order.py b/rerun_py/rerun_sdk/rerun/blueprint/components/sort_order.py deleted file mode 100644 index e9c31f2468d4..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/sort_order.py +++ /dev/null @@ -1,75 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/python/mod.rs -# Based on "crates/store/re_types/definitions/rerun/blueprint/components/sort_order.fbs". - -# You can extend this class by creating a "SortOrderExt" class in "sort_order_ext.py". - -from __future__ import annotations - -from typing import Literal, Sequence, Union - -import pyarrow as pa - -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, - ComponentBatchMixin, -) - -__all__ = ["SortOrder", "SortOrderArrayLike", "SortOrderBatch", "SortOrderLike", "SortOrderType"] - - -from enum import Enum - - -class SortOrder(Enum): - """**Component**: Sort order for data table.""" - - Ascending = 1 - """Ascending""" - - Descending = 2 - """Descending""" - - @classmethod - def auto(cls, val: str | int | SortOrder) -> SortOrder: - """Best-effort converter, including a case-insensitive string matcher.""" - if isinstance(val, SortOrder): - return val - if isinstance(val, int): - return cls(val) - try: - return cls[val] - except KeyError: - val_lower = val.lower() - for variant in cls: - if variant.name.lower() == val_lower: - return variant - raise ValueError(f"Cannot convert {val} to {cls.__name__}") - - def __str__(self) -> str: - """Returns the variant name.""" - return self.name - - -SortOrderLike = Union[SortOrder, Literal["Ascending", "Descending", "ascending", "descending"], int] -SortOrderArrayLike = Union[SortOrderLike, Sequence[SortOrderLike]] - - -class SortOrderType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.components.SortOrder" - - def __init__(self) -> None: - pa.ExtensionType.__init__(self, pa.uint8(), self._TYPE_NAME) - - -class SortOrderBatch(BaseBatch[SortOrderArrayLike], ComponentBatchMixin): - _ARROW_TYPE = SortOrderType() - - @staticmethod - def _native_to_pa_array(data: SortOrderArrayLike, data_type: pa.DataType) -> pa.Array: - if isinstance(data, (SortOrder, int, str)): - data = [data] - - pa_data = [SortOrder.auto(v).value if v is not None else None for v in data] # type: ignore[redundant-expr] - - return pa.array(pa_data, type=data_type)