From 5df925fbdb3beb6ba1cd890b1633ef19b3c0c737 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Wed, 2 Oct 2024 19:17:12 +0200 Subject: [PATCH 1/5] remove dead fbs --- .../blueprint/archetypes/dataframe_query.fbs | 51 -- .../rerun/blueprint/components.fbs | 3 - .../components/latest_at_queries.fbs | 14 - .../rerun/blueprint/components/query_kind.fbs | 16 - .../components/time_range_queries.fbs | 14 - .../definitions/rerun/blueprint/datatypes.fbs | 2 - .../blueprint/datatypes/latest_at_query.fbs | 15 - .../blueprint/datatypes/time_range_query.fbs | 30 - .../src/blueprint/archetypes/.gitattributes | 1 - .../blueprint/archetypes/dataframe_query.rs | 275 --------- .../re_types/src/blueprint/archetypes/mod.rs | 2 - .../src/blueprint/components/.gitattributes | 3 - .../blueprint/components/latest_at_queries.rs | 184 ------ .../components/latest_at_queries_ext.rs | 22 - .../re_types/src/blueprint/components/mod.rs | 8 - .../src/blueprint/components/query_kind.rs | 151 ----- .../components/time_range_queries.rs | 184 ------ .../components/time_range_queries_ext.rs | 22 - .../src/blueprint/datatypes/.gitattributes | 2 - .../blueprint/datatypes/latest_at_query.rs | 285 --------- .../datatypes/latest_at_query_ext.rs | 12 - .../re_types/src/blueprint/datatypes/mod.rs | 6 - .../blueprint/datatypes/time_range_query.rs | 567 ------------------ .../datatypes/time_range_query_ext.rs | 14 - .../src/blueprint/validation_gen/mod.rs | 6 - crates/viewer/re_viewer/src/reflection/mod.rs | 45 -- rerun_cpp/src/rerun/blueprint/archetypes.hpp | 1 - .../rerun/blueprint/archetypes/.gitattributes | 2 - .../blueprint/archetypes/dataframe_query.cpp | 49 -- .../blueprint/archetypes/dataframe_query.hpp | 107 ---- rerun_cpp/src/rerun/blueprint/components.hpp | 3 - .../rerun/blueprint/components/.gitattributes | 6 - .../components/latest_at_queries.cpp | 81 --- .../components/latest_at_queries.hpp | 65 -- .../rerun/blueprint/components/query_kind.cpp | 58 -- .../rerun/blueprint/components/query_kind.hpp | 57 -- .../components/time_range_queries.cpp | 81 --- .../components/time_range_queries.hpp | 65 -- rerun_cpp/src/rerun/blueprint/datatypes.hpp | 2 - .../rerun/blueprint/datatypes/.gitattributes | 4 - .../blueprint/datatypes/latest_at_query.cpp | 86 --- .../blueprint/datatypes/latest_at_query.hpp | 56 -- .../blueprint/datatypes/time_range_query.cpp | 131 ---- .../blueprint/datatypes/time_range_query.hpp | 72 --- .../rerun_sdk/rerun/blueprint/__init__.py | 3 - .../rerun/blueprint/archetypes/.gitattributes | 1 - .../rerun/blueprint/archetypes/__init__.py | 2 - .../blueprint/archetypes/dataframe_query.py | 123 ---- .../rerun/blueprint/components/.gitattributes | 3 - .../rerun/blueprint/components/__init__.py | 30 - .../blueprint/components/latest_at_queries.py | 88 --- .../rerun/blueprint/components/query_kind.py | 75 --- .../components/time_range_queries.py | 91 --- .../rerun/blueprint/datatypes/.gitattributes | 2 - .../rerun/blueprint/datatypes/__init__.py | 24 - .../blueprint/datatypes/latest_at_query.py | 100 --- .../datatypes/latest_at_query_ext.py | 17 - .../blueprint/datatypes/time_range_query.py | 170 ------ .../datatypes/time_range_query_ext.py | 24 - 59 files changed, 3613 deletions(-) delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/latest_at_queries.fbs delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/query_kind.fbs delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/components/time_range_queries.fbs delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/datatypes/latest_at_query.fbs delete mode 100644 crates/store/re_types/definitions/rerun/blueprint/datatypes/time_range_query.fbs delete mode 100644 crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs delete mode 100644 crates/store/re_types/src/blueprint/components/latest_at_queries.rs delete mode 100644 crates/store/re_types/src/blueprint/components/latest_at_queries_ext.rs delete mode 100644 crates/store/re_types/src/blueprint/components/query_kind.rs delete mode 100644 crates/store/re_types/src/blueprint/components/time_range_queries.rs delete mode 100644 crates/store/re_types/src/blueprint/components/time_range_queries_ext.rs delete mode 100644 crates/store/re_types/src/blueprint/datatypes/latest_at_query.rs delete mode 100644 crates/store/re_types/src/blueprint/datatypes/latest_at_query_ext.rs delete mode 100644 crates/store/re_types/src/blueprint/datatypes/time_range_query.rs delete mode 100644 crates/store/re_types/src/blueprint/datatypes/time_range_query_ext.rs delete mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/latest_at_queries.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/latest_at_queries.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/query_kind.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/query_kind.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/time_range_queries.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/components/time_range_queries.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.hpp delete mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.hpp delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/latest_at_queries.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/query_kind.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/components/time_range_queries.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query_ext.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query.py delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query_ext.py diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs index aed1f5b1b0e0..bb3f8b55e867 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs @@ -1,57 +1,6 @@ namespace rerun.blueprint.archetypes; -// Rationale behind the present data modelling: -// - Avoid using `union` at all cost. -// - An explicit "mode" enum maps well with a UI toggle and API parameter, and enabled a hard disambiguation when -// settings are present for both the latest-at and range modes. -// - Timestamps are hard-invalidated by a change of timeline. So we keep them on a per-timeline basis. - -// TODO(#7067): add visible components (maybe in another archetype?) -// TODO(#7072): add (optional) PoV components -// Note: component list should be modelled as: -// component PovComponents { -// datatype ComponentNames { -// value: [string]; -// } -// } -// -// Motivation: -// - Chances are high that the user prefers to have their pov components _not_ invalidated by a changeof timeline. -// - That is even though a component might _technically_ be soft-invalidated by a change of timeline (e.g. if it was -// not logged on that particular timeline). But we have to deal regardless with potentially invalid component, so this -// doesn't change the story much. - -// -- - -/// The query for the dataframe view. -//TODO(ab): replace by DataframeQueryV2 when ready -table DataframeQuery ( - "attr.rerun.scope": "blueprint" -) { - // --- Optional --- - - /// The timeline for this query. - /// - /// If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - timeline: rerun.blueprint.components.TimelineName ("attr.rerun.component_optional", nullable, order: 100); - - /// Kind of query: latest-at or range. - kind: rerun.blueprint.components.QueryKind ("attr.rerun.component_optional", nullable,order: 200); - - /// Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. - latest_at_queries: rerun.blueprint.components.LatestAtQueries ("attr.rerun.component_optional", nullable,order: 400); - - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - time_range_queries: rerun.blueprint.components.TimeRangeQueries ("attr.rerun.component_optional", nullable,order: 500); -} - - - /// The query for the dataframe view. table DataframeQueryV2 ( "attr.rerun.scope": "blueprint" diff --git a/crates/store/re_types/definitions/rerun/blueprint/components.fbs b/crates/store/re_types/definitions/rerun/blueprint/components.fbs index e2d03b25554c..a562365eb2c0 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/components.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/components.fbs @@ -15,11 +15,9 @@ include "./components/grid_columns.fbs"; include "./components/included_content.fbs"; include "./components/included_space_view.fbs"; include "./components/interactive.fbs"; -include "./components/latest_at_queries.fbs"; include "./components/lock_range_during_zoom.fbs"; include "./components/panel_state.fbs"; include "./components/query_expression.fbs"; -include "./components/query_kind.fbs"; include "./components/root_container.fbs"; include "./components/row_share.fbs"; include "./components/selected_columns.fbs"; @@ -27,7 +25,6 @@ include "./components/space_view_class.fbs"; include "./components/space_view_maximized.fbs"; include "./components/space_view_origin.fbs"; include "./components/tensor_dimension_index_slider.fbs"; -include "./components/time_range_queries.fbs"; include "./components/timeline_name.fbs"; include "./components/view_fit.fbs"; include "./components/viewer_recommendation_hash.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/latest_at_queries.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/latest_at_queries.fbs deleted file mode 100644 index 1c09a7aebce0..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/components/latest_at_queries.fbs +++ /dev/null @@ -1,14 +0,0 @@ - -namespace rerun.blueprint.components; - -/// Configuration for latest-at queries. -/// -/// Note: configuration as saved on a per-timeline basis. -table LatestAtQueries ( - "attr.arrow.transparent", - "attr.rust.derive": "Default, PartialEq, Eq", - "attr.rust.repr": "transparent", - "attr.rerun.scope": "blueprint" -) { - queries: [rerun.blueprint.datatypes.LatestAtQuery] (order: 100); -} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/query_kind.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/query_kind.fbs deleted file mode 100644 index b4c91f52601a..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/components/query_kind.fbs +++ /dev/null @@ -1,16 +0,0 @@ -namespace rerun.blueprint.components; - - -/// The kind of query displayed by the dataframe view -enum QueryKind: ubyte ( - "attr.rerun.scope": "blueprint" -) { - /// Invalid value. Won't show up in generated types. - Invalid = 0, - - /// Query - LatestAt (default), - - /// Time range query. - TimeRange, -} diff --git a/crates/store/re_types/definitions/rerun/blueprint/components/time_range_queries.fbs b/crates/store/re_types/definitions/rerun/blueprint/components/time_range_queries.fbs deleted file mode 100644 index cfa60cd84d57..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/components/time_range_queries.fbs +++ /dev/null @@ -1,14 +0,0 @@ - -namespace rerun.blueprint.components; - -/// Configuration for time range queries. -/// -/// Note: configuration as saved on a per-timeline basis. -table TimeRangeQueries ( - "attr.arrow.transparent", - "attr.rust.derive": "Default, PartialEq, Eq", - "attr.rust.repr": "transparent", - "attr.rerun.scope": "blueprint" -) { - queries: [rerun.blueprint.datatypes.TimeRangeQuery] (order: 100); -} diff --git a/crates/store/re_types/definitions/rerun/blueprint/datatypes.fbs b/crates/store/re_types/definitions/rerun/blueprint/datatypes.fbs index 59ede3e6ccd5..854b6b9272ff 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/datatypes.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/datatypes.fbs @@ -3,8 +3,6 @@ include "./datatypes/component_column_selector.fbs"; include "./datatypes/filter_by_event.fbs"; include "./datatypes/filter_by_range.fbs"; -include "./datatypes/latest_at_query.fbs"; include "./datatypes/selected_columns.fbs"; include "./datatypes/tensor_dimension_index_slider.fbs"; -include "./datatypes/time_range_query.fbs"; include "./datatypes/utf8_list.fbs"; diff --git a/crates/store/re_types/definitions/rerun/blueprint/datatypes/latest_at_query.fbs b/crates/store/re_types/definitions/rerun/blueprint/datatypes/latest_at_query.fbs deleted file mode 100644 index eadcbf133143..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/datatypes/latest_at_query.fbs +++ /dev/null @@ -1,15 +0,0 @@ -namespace rerun.blueprint.datatypes; - - -/// Latest-at query configuration for a specific timeline. -// Has to be a table because flatbuffer doesn't support strings in structs. -table LatestAtQuery ( - "attr.rust.derive": "PartialEq, Eq", - "attr.rerun.scope": "blueprint" -) { - /// Name of the timeline this applies to. - timeline: rerun.datatypes.Utf8 (order: 100); - - /// Time value to use for this query. - time: rerun.datatypes.TimeInt (order: 200); -} diff --git a/crates/store/re_types/definitions/rerun/blueprint/datatypes/time_range_query.fbs b/crates/store/re_types/definitions/rerun/blueprint/datatypes/time_range_query.fbs deleted file mode 100644 index 96ce8024fc90..000000000000 --- a/crates/store/re_types/definitions/rerun/blueprint/datatypes/time_range_query.fbs +++ /dev/null @@ -1,30 +0,0 @@ -namespace rerun.blueprint.datatypes; - - -/// Time range query configuration for a specific timeline. -// Has to be a table because flatbuffer doesn't support strings in structs. -table TimeRangeQuery ( - "attr.rust.derive": "PartialEq, Eq", - "attr.rerun.scope": "blueprint" -) { - /// Name of the timeline this applies to. - timeline: rerun.datatypes.Utf8 (order: 100); - - /// Point-of-view entity. - /// - /// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - /// in the results returned by the range query. - pov_entity: rerun.datatypes.EntityPath (order: 200); - - /// Point-of-view component. - /// - /// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - /// in the results returned by the range query. - pov_component: rerun.datatypes.Utf8 (order: 300); - - /// Beginning of the time range. - start: rerun.datatypes.TimeInt (order: 400); - - /// End of the time range (inclusive). - end: rerun.datatypes.TimeInt (order: 500); -} diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index ced82b80ceda..edde431a5d88 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -2,7 +2,6 @@ .gitattributes linguist-generated=true background.rs linguist-generated=true -dataframe_query.rs linguist-generated=true dataframe_query_v2.rs linguist-generated=true mod.rs linguist-generated=true plot_legend.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs deleted file mode 100644 index 29205b3c7810..000000000000 --- a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs +++ /dev/null @@ -1,275 +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/dataframe_query.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**: The query for the dataframe view. -#[derive(Clone, Debug)] -pub struct DataframeQuery { - /// The timeline for this query. - /// - /// If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - pub timeline: Option, - - /// Kind of query: latest-at or range. - pub kind: Option, - - /// Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. - pub latest_at_queries: Option, - - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - pub time_range_queries: Option, -} - -impl ::re_types_core::SizeBytes for DataframeQuery { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timeline.heap_size_bytes() - + self.kind.heap_size_bytes() - + self.latest_at_queries.heap_size_bytes() - + self.time_range_queries.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::is_pod() - && >::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.DataframeQueryIndicator".into()]); - -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.TimelineName".into(), - "rerun.blueprint.components.QueryKind".into(), - "rerun.blueprint.components.LatestAtQueries".into(), - "rerun.blueprint.components.TimeRangeQueries".into(), - ] - }); - -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.DataframeQueryIndicator".into(), - "rerun.blueprint.components.TimelineName".into(), - "rerun.blueprint.components.QueryKind".into(), - "rerun.blueprint.components.LatestAtQueries".into(), - "rerun.blueprint.components.TimeRangeQueries".into(), - ] - }); - -impl DataframeQuery { - /// The total number of components in the archetype: 0 required, 1 recommended, 4 optional - pub const NUM_COMPONENTS: usize = 5usize; -} - -/// Indicator component for the [`DataframeQuery`] [`::re_types_core::Archetype`] -pub type DataframeQueryIndicator = ::re_types_core::GenericIndicatorComponent; - -impl ::re_types_core::Archetype for DataframeQuery { - type Indicator = DataframeQueryIndicator; - - #[inline] - fn name() -> ::re_types_core::ArchetypeName { - "rerun.blueprint.archetypes.DataframeQuery".into() - } - - #[inline] - fn display_name() -> &'static str { - "Dataframe query" - } - - #[inline] - fn indicator() -> MaybeOwnedComponentBatch<'static> { - static INDICATOR: DataframeQueryIndicator = DataframeQueryIndicator::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 timeline = - if let Some(array) = arrays_by_name.get("rerun.blueprint.components.TimelineName") { - ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQuery#timeline")? - .into_iter() - .next() - .flatten() - } else { - None - }; - let kind = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.QueryKind") { - ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQuery#kind")? - .into_iter() - .next() - .flatten() - } else { - None - }; - let latest_at_queries = - if let Some(array) = arrays_by_name.get("rerun.blueprint.components.LatestAtQueries") { - ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQuery#latest_at_queries")? - .into_iter() - .next() - .flatten() - } else { - None - }; - let time_range_queries = if let Some(array) = - arrays_by_name.get("rerun.blueprint.components.TimeRangeQueries") - { - ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQuery#time_range_queries")? - .into_iter() - .next() - .flatten() - } else { - None - }; - Ok(Self { - timeline, - kind, - latest_at_queries, - time_range_queries, - }) - } -} - -impl ::re_types_core::AsComponents for DataframeQuery { - fn as_component_batches(&self) -> Vec> { - re_tracing::profile_function!(); - use ::re_types_core::Archetype as _; - [ - Some(Self::indicator()), - self.timeline - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.kind - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.latest_at_queries - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.time_range_queries - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - ] - .into_iter() - .flatten() - .collect() - } -} - -impl ::re_types_core::ArchetypeReflectionMarker for DataframeQuery {} - -impl DataframeQuery { - /// Create a new `DataframeQuery`. - #[inline] - pub fn new() -> Self { - Self { - timeline: None, - kind: None, - latest_at_queries: None, - time_range_queries: None, - } - } - - /// The timeline for this query. - /// - /// If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - #[inline] - pub fn with_timeline( - mut self, - timeline: impl Into, - ) -> Self { - self.timeline = Some(timeline.into()); - self - } - - /// Kind of query: latest-at or range. - #[inline] - pub fn with_kind(mut self, kind: impl Into) -> Self { - self.kind = Some(kind.into()); - self - } - - /// Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. - #[inline] - pub fn with_latest_at_queries( - mut self, - latest_at_queries: impl Into, - ) -> Self { - self.latest_at_queries = Some(latest_at_queries.into()); - self - } - - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - #[inline] - pub fn with_time_range_queries( - mut self, - time_range_queries: impl Into, - ) -> Self { - self.time_range_queries = Some(time_range_queries.into()); - self - } -} diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index 8e48933ed614..250c53af0a1a 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -1,7 +1,6 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs mod background; -mod dataframe_query; mod dataframe_query_v2; mod plot_legend; mod scalar_axis; @@ -15,7 +14,6 @@ mod visible_time_ranges_ext; mod visual_bounds2d; pub use self::background::Background; -pub use self::dataframe_query::DataframeQuery; pub use self::dataframe_query_v2::DataframeQueryV2; pub use self::plot_legend::PlotLegend; pub use self::scalar_axis::ScalarAxis; diff --git a/crates/store/re_types/src/blueprint/components/.gitattributes b/crates/store/re_types/src/blueprint/components/.gitattributes index 18fe2582947e..caac94c7d551 100644 --- a/crates/store/re_types/src/blueprint/components/.gitattributes +++ b/crates/store/re_types/src/blueprint/components/.gitattributes @@ -11,18 +11,15 @@ filter_by_event.rs linguist-generated=true filter_by_range.rs linguist-generated=true included_content.rs linguist-generated=true interactive.rs linguist-generated=true -latest_at_queries.rs linguist-generated=true lock_range_during_zoom.rs linguist-generated=true mod.rs linguist-generated=true panel_state.rs linguist-generated=true query_expression.rs linguist-generated=true -query_kind.rs linguist-generated=true row_share.rs linguist-generated=true selected_columns.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 -time_range_queries.rs linguist-generated=true timeline_name.rs linguist-generated=true view_fit.rs linguist-generated=true viewer_recommendation_hash.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/components/latest_at_queries.rs b/crates/store/re_types/src/blueprint/components/latest_at_queries.rs deleted file mode 100644 index 866a163cd757..000000000000 --- a/crates/store/re_types/src/blueprint/components/latest_at_queries.rs +++ /dev/null @@ -1,184 +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/latest_at_queries.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**: Configuration for latest-at queries. -/// -/// Note: configuration as saved on a per-timeline basis. -#[derive(Clone, Debug, Default, PartialEq, Eq)] -#[repr(transparent)] -pub struct LatestAtQueries(pub Vec); - -impl ::re_types_core::SizeBytes for LatestAtQueries { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From - for LatestAtQueries -{ - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) - } -} - -::re_types_core::macros::impl_into_cow!(LatestAtQueries); - -impl ::re_types_core::Loggable for LatestAtQueries { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.components.LatestAtQueries".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::List(std::sync::Arc::new(Field::new( - "item", - ::arrow_datatype(), - false, - ))) - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - #![allow(clippy::manual_is_variant_and)] - 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.into_owned().0); - (datum.is_some(), datum) - }) - .unzip(); - let data0_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - use arrow2::{buffer::Buffer, offset::OffsetsBuffer}; - let offsets = arrow2::offset::Offsets::::try_from_lengths( - data0 - .iter() - .map(|opt| opt.as_ref().map_or(0, |datum| datum.len())), - )? - .into(); - let data0_inner_data: Vec<_> = data0.into_iter().flatten().flatten().collect(); - let data0_inner_bitmap: Option = None; - ListArray::try_new( - Self::arrow_datatype(), - offsets, - { - _ = data0_inner_bitmap; - crate::blueprint::datatypes::LatestAtQuery::to_arrow_opt( - data0_inner_data.into_iter().map(Some), - )? - }, - 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({ - let arrow_data = 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.LatestAtQueries#queries")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let arrow_data_inner = { - let arrow_data_inner = &**arrow_data.values(); - crate::blueprint::datatypes::LatestAtQuery::from_arrow_opt(arrow_data_inner) - .with_context("rerun.blueprint.components.LatestAtQueries#queries")? - .into_iter() - .collect::>() - }; - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_inner.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = unsafe { arrow_data_inner.get_unchecked(start..end) }; - let data = data - .iter() - .cloned() - .map(Option::unwrap_or_default) - .collect(); - Ok(data) - }) - .transpose() - }) - .collect::>>>()? - } - .into_iter() - } - .map(|v| v.ok_or_else(DeserializationError::missing_data)) - .map(|res| res.map(|v| Some(Self(v)))) - .collect::>>>() - .with_context("rerun.blueprint.components.LatestAtQueries#queries") - .with_context("rerun.blueprint.components.LatestAtQueries")?) - } -} diff --git a/crates/store/re_types/src/blueprint/components/latest_at_queries_ext.rs b/crates/store/re_types/src/blueprint/components/latest_at_queries_ext.rs deleted file mode 100644 index f5804cb488ab..000000000000 --- a/crates/store/re_types/src/blueprint/components/latest_at_queries_ext.rs +++ /dev/null @@ -1,22 +0,0 @@ -use re_log_types::TimelineName; - -use super::LatestAtQueries; -use crate::blueprint::datatypes::LatestAtQuery; - -impl LatestAtQueries { - /// Retrieves the query for a given timeline. - pub fn query_for_timeline(&self, timeline_name: &TimelineName) -> Option<&LatestAtQuery> { - self.0 - .iter() - .find(|query| query.timeline.as_str() == timeline_name.as_str()) - } - - /// Sets the query for a given timeline. - pub fn set_query_for_timeline(&mut self, query: LatestAtQuery) { - if let Some(existing_query) = self.0.iter_mut().find(|q| q.timeline == query.timeline) { - *existing_query = query; - } else { - self.0.push(query); - } - } -} diff --git a/crates/store/re_types/src/blueprint/components/mod.rs b/crates/store/re_types/src/blueprint/components/mod.rs index 8b7cdc140394..3b8c3f2e3a5f 100644 --- a/crates/store/re_types/src/blueprint/components/mod.rs +++ b/crates/store/re_types/src/blueprint/components/mod.rs @@ -15,13 +15,10 @@ mod filter_by_range_ext; mod included_content; mod interactive; mod interactive_ext; -mod latest_at_queries; -mod latest_at_queries_ext; mod lock_range_during_zoom; mod panel_state; mod panel_state_ext; mod query_expression; -mod query_kind; mod row_share; mod selected_columns; mod space_view_class; @@ -30,8 +27,6 @@ mod space_view_origin; mod space_view_origin_ext; mod tensor_dimension_index_slider; mod tensor_dimension_index_slider_ext; -mod time_range_queries; -mod time_range_queries_ext; mod timeline_name; mod timeline_name_ext; mod view_fit; @@ -53,17 +48,14 @@ pub use self::filter_by_event::FilterByEvent; pub use self::filter_by_range::FilterByRange; pub use self::included_content::IncludedContent; pub use self::interactive::Interactive; -pub use self::latest_at_queries::LatestAtQueries; pub use self::lock_range_during_zoom::LockRangeDuringZoom; 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::selected_columns::SelectedColumns; pub use self::space_view_class::SpaceViewClass; pub use self::space_view_origin::SpaceViewOrigin; pub use self::tensor_dimension_index_slider::TensorDimensionIndexSlider; -pub use self::time_range_queries::TimeRangeQueries; pub use self::timeline_name::TimelineName; pub use self::view_fit::ViewFit; pub use self::viewer_recommendation_hash::ViewerRecommendationHash; diff --git a/crates/store/re_types/src/blueprint/components/query_kind.rs b/crates/store/re_types/src/blueprint/components/query_kind.rs deleted file mode 100644 index dd097cb41beb..000000000000 --- a/crates/store/re_types/src/blueprint/components/query_kind.rs +++ /dev/null @@ -1,151 +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/query_kind.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**: The kind of query displayed by the dataframe view -#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Default)] -#[repr(u8)] -pub enum QueryKind { - /// Query - #[default] - LatestAt = 1, - - /// Time range query. - TimeRange = 2, -} - -impl ::re_types_core::reflection::Enum for QueryKind { - #[inline] - fn variants() -> &'static [Self] { - &[Self::LatestAt, Self::TimeRange] - } - - #[inline] - fn docstring_md(self) -> &'static str { - match self { - Self::LatestAt => "Query", - Self::TimeRange => "Time range query.", - } - } -} - -impl ::re_types_core::SizeBytes for QueryKind { - #[inline] - fn heap_size_bytes(&self) -> u64 { - 0 - } - - #[inline] - fn is_pod() -> bool { - true - } -} - -impl std::fmt::Display for QueryKind { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::LatestAt => write!(f, "LatestAt"), - Self::TimeRange => write!(f, "TimeRange"), - } - } -} - -::re_types_core::macros::impl_into_cow!(QueryKind); - -impl ::re_types_core::Loggable for QueryKind { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.components.QueryKind".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)] - #![allow(clippy::manual_is_variant_and)] - 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.QueryKind#enum")? - .into_iter() - .map(|opt| opt.copied()) - .map(|typ| match typ { - Some(1) => Ok(Some(Self::LatestAt)), - Some(2) => Ok(Some(Self::TimeRange)), - None => Ok(None), - Some(invalid) => Err(DeserializationError::missing_union_arm( - Self::arrow_datatype(), - "", - invalid as _, - )), - }) - .collect::>>>() - .with_context("rerun.blueprint.components.QueryKind")?) - } -} diff --git a/crates/store/re_types/src/blueprint/components/time_range_queries.rs b/crates/store/re_types/src/blueprint/components/time_range_queries.rs deleted file mode 100644 index 069362e39bc1..000000000000 --- a/crates/store/re_types/src/blueprint/components/time_range_queries.rs +++ /dev/null @@ -1,184 +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/time_range_queries.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**: Configuration for time range queries. -/// -/// Note: configuration as saved on a per-timeline basis. -#[derive(Clone, Debug, Default, PartialEq, Eq)] -#[repr(transparent)] -pub struct TimeRangeQueries(pub Vec); - -impl ::re_types_core::SizeBytes for TimeRangeQueries { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.0.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - } -} - -impl, T: IntoIterator> From - for TimeRangeQueries -{ - fn from(v: T) -> Self { - Self(v.into_iter().map(|v| v.into()).collect()) - } -} - -::re_types_core::macros::impl_into_cow!(TimeRangeQueries); - -impl ::re_types_core::Loggable for TimeRangeQueries { - type Name = ::re_types_core::ComponentName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.components.TimeRangeQueries".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::List(std::sync::Arc::new(Field::new( - "item", - ::arrow_datatype(), - false, - ))) - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - #![allow(clippy::manual_is_variant_and)] - 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.into_owned().0); - (datum.is_some(), datum) - }) - .unzip(); - let data0_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - use arrow2::{buffer::Buffer, offset::OffsetsBuffer}; - let offsets = arrow2::offset::Offsets::::try_from_lengths( - data0 - .iter() - .map(|opt| opt.as_ref().map_or(0, |datum| datum.len())), - )? - .into(); - let data0_inner_data: Vec<_> = data0.into_iter().flatten().flatten().collect(); - let data0_inner_bitmap: Option = None; - ListArray::try_new( - Self::arrow_datatype(), - offsets, - { - _ = data0_inner_bitmap; - crate::blueprint::datatypes::TimeRangeQuery::to_arrow_opt( - data0_inner_data.into_iter().map(Some), - )? - }, - 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({ - let arrow_data = 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.TimeRangeQueries#queries")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let arrow_data_inner = { - let arrow_data_inner = &**arrow_data.values(); - crate::blueprint::datatypes::TimeRangeQuery::from_arrow_opt(arrow_data_inner) - .with_context("rerun.blueprint.components.TimeRangeQueries#queries")? - .into_iter() - .collect::>() - }; - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_inner.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_inner.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = unsafe { arrow_data_inner.get_unchecked(start..end) }; - let data = data - .iter() - .cloned() - .map(Option::unwrap_or_default) - .collect(); - Ok(data) - }) - .transpose() - }) - .collect::>>>()? - } - .into_iter() - } - .map(|v| v.ok_or_else(DeserializationError::missing_data)) - .map(|res| res.map(|v| Some(Self(v)))) - .collect::>>>() - .with_context("rerun.blueprint.components.TimeRangeQueries#queries") - .with_context("rerun.blueprint.components.TimeRangeQueries")?) - } -} diff --git a/crates/store/re_types/src/blueprint/components/time_range_queries_ext.rs b/crates/store/re_types/src/blueprint/components/time_range_queries_ext.rs deleted file mode 100644 index 5e43fea06fd8..000000000000 --- a/crates/store/re_types/src/blueprint/components/time_range_queries_ext.rs +++ /dev/null @@ -1,22 +0,0 @@ -use re_log_types::TimelineName; - -use super::TimeRangeQueries; -use crate::blueprint::datatypes::TimeRangeQuery; - -impl TimeRangeQueries { - /// Retrieves the query for a given timeline. - pub fn query_for_timeline(&self, timeline_name: &TimelineName) -> Option<&TimeRangeQuery> { - self.0 - .iter() - .find(|query| query.timeline.as_str() == timeline_name.as_str()) - } - - /// Sets the query for a given timeline. - pub fn set_query_for_timeline(&mut self, query: TimeRangeQuery) { - if let Some(existing_query) = self.0.iter_mut().find(|q| q.timeline == query.timeline) { - *existing_query = query; - } else { - self.0.push(query); - } - } -} diff --git a/crates/store/re_types/src/blueprint/datatypes/.gitattributes b/crates/store/re_types/src/blueprint/datatypes/.gitattributes index 437f7b5ea243..1437a4c59c07 100644 --- a/crates/store/re_types/src/blueprint/datatypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/datatypes/.gitattributes @@ -4,8 +4,6 @@ component_column_selector.rs linguist-generated=true filter_by_event.rs linguist-generated=true filter_by_range.rs linguist-generated=true -latest_at_query.rs linguist-generated=true mod.rs linguist-generated=true selected_columns.rs linguist-generated=true tensor_dimension_index_slider.rs linguist-generated=true -time_range_query.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/datatypes/latest_at_query.rs b/crates/store/re_types/src/blueprint/datatypes/latest_at_query.rs deleted file mode 100644 index d688340ee13e..000000000000 --- a/crates/store/re_types/src/blueprint/datatypes/latest_at_query.rs +++ /dev/null @@ -1,285 +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/datatypes/latest_at_query.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}; - -/// **Datatype**: Latest-at query configuration for a specific timeline. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct LatestAtQuery { - /// Name of the timeline this applies to. - pub timeline: crate::datatypes::Utf8, - - /// Time value to use for this query. - pub time: crate::datatypes::TimeInt, -} - -impl ::re_types_core::SizeBytes for LatestAtQuery { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timeline.heap_size_bytes() + self.time.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() && ::is_pod() - } -} - -::re_types_core::macros::impl_into_cow!(LatestAtQuery); - -impl ::re_types_core::Loggable for LatestAtQuery { - type Name = ::re_types_core::DatatypeName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.datatypes.LatestAtQuery".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::Struct(std::sync::Arc::new(vec![ - Field::new( - "timeline", - ::arrow_datatype(), - false, - ), - Field::new("time", ::arrow_datatype(), false), - ])) - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - #![allow(clippy::manual_is_variant_and)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - (datum.is_some(), datum) - }) - .unzip(); - let bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - StructArray::new( - Self::arrow_datatype(), - vec![ - { - let (somes, timeline): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.timeline.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let timeline_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - let offsets = arrow2::offset::Offsets::::try_from_lengths( - timeline.iter().map(|opt| { - opt.as_ref().map(|datum| datum.0.len()).unwrap_or_default() - }), - )? - .into(); - let inner_data: arrow2::buffer::Buffer = timeline - .into_iter() - .flatten() - .flat_map(|datum| datum.0 .0) - .collect(); - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - unsafe { - Utf8Array::::new_unchecked( - DataType::Utf8, - offsets, - inner_data, - timeline_bitmap, - ) - } - .boxed() - } - }, - { - let (somes, time): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.time.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let time_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - PrimitiveArray::new( - DataType::Int64, - time.into_iter() - .map(|datum| datum.map(|datum| datum.0).unwrap_or_default()) - .collect(), - time_bitmap, - ) - .boxed() - }, - ], - 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({ - let arrow_data = 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.datatypes.LatestAtQuery")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let (arrow_data_fields, arrow_data_arrays) = - (arrow_data.fields(), arrow_data.values()); - let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data_fields - .iter() - .map(|field| field.name.as_str()) - .zip(arrow_data_arrays) - .collect(); - let timeline = { - if !arrays_by_name.contains_key("timeline") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "timeline", - )) - .with_context("rerun.blueprint.datatypes.LatestAtQuery"); - } - let arrow_data = &**arrays_by_name["timeline"]; - { - let arrow_data = arrow_data - .as_any() - .downcast_ref::>() - .ok_or_else(|| { - let expected = DataType::Utf8; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.datatypes.LatestAtQuery#timeline")?; - let arrow_data_buf = arrow_data.values(); - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_buf.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = - unsafe { arrow_data_buf.clone().sliced_unchecked(start, len) }; - Ok(data) - }) - .transpose() - }) - .map(|res_or_opt| { - res_or_opt.map(|res_or_opt| { - res_or_opt.map(|v| { - crate::datatypes::Utf8(::re_types_core::ArrowString(v)) - }) - }) - }) - .collect::>>>() - .with_context("rerun.blueprint.datatypes.LatestAtQuery#timeline")? - .into_iter() - } - }; - let time = { - if !arrays_by_name.contains_key("time") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "time", - )) - .with_context("rerun.blueprint.datatypes.LatestAtQuery"); - } - let arrow_data = &**arrays_by_name["time"]; - arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = DataType::Int64; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.datatypes.LatestAtQuery#time")? - .into_iter() - .map(|opt| opt.copied()) - .map(|res_or_opt| res_or_opt.map(crate::datatypes::TimeInt)) - }; - arrow2::bitmap::utils::ZipValidity::new_with_validity( - ::itertools::izip!(timeline, time), - arrow_data.validity(), - ) - .map(|opt| { - opt.map(|(timeline, time)| { - Ok(Self { - timeline: timeline - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.datatypes.LatestAtQuery#timeline")?, - time: time - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.datatypes.LatestAtQuery#time")?, - }) - }) - .transpose() - }) - .collect::>>() - .with_context("rerun.blueprint.datatypes.LatestAtQuery")? - } - }) - } -} diff --git a/crates/store/re_types/src/blueprint/datatypes/latest_at_query_ext.rs b/crates/store/re_types/src/blueprint/datatypes/latest_at_query_ext.rs deleted file mode 100644 index 5b2c1ad2138e..000000000000 --- a/crates/store/re_types/src/blueprint/datatypes/latest_at_query_ext.rs +++ /dev/null @@ -1,12 +0,0 @@ -use re_types_core::datatypes::{TimeInt, Utf8}; - -use super::LatestAtQuery; - -impl Default for LatestAtQuery { - fn default() -> Self { - Self { - timeline: Utf8::from("log_time"), - time: TimeInt::MAX, - } - } -} diff --git a/crates/store/re_types/src/blueprint/datatypes/mod.rs b/crates/store/re_types/src/blueprint/datatypes/mod.rs index 67905a645ebc..22a07b776506 100644 --- a/crates/store/re_types/src/blueprint/datatypes/mod.rs +++ b/crates/store/re_types/src/blueprint/datatypes/mod.rs @@ -4,17 +4,11 @@ mod component_column_selector; mod component_column_selector_ext; mod filter_by_event; mod filter_by_range; -mod latest_at_query; -mod latest_at_query_ext; mod selected_columns; mod tensor_dimension_index_slider; -mod time_range_query; -mod time_range_query_ext; pub use self::component_column_selector::ComponentColumnSelector; pub use self::filter_by_event::FilterByEvent; pub use self::filter_by_range::FilterByRange; -pub use self::latest_at_query::LatestAtQuery; pub use self::selected_columns::SelectedColumns; pub use self::tensor_dimension_index_slider::TensorDimensionIndexSlider; -pub use self::time_range_query::TimeRangeQuery; diff --git a/crates/store/re_types/src/blueprint/datatypes/time_range_query.rs b/crates/store/re_types/src/blueprint/datatypes/time_range_query.rs deleted file mode 100644 index 4b2b9680698b..000000000000 --- a/crates/store/re_types/src/blueprint/datatypes/time_range_query.rs +++ /dev/null @@ -1,567 +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/datatypes/time_range_query.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}; - -/// **Datatype**: Time range query configuration for a specific timeline. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct TimeRangeQuery { - /// Name of the timeline this applies to. - pub timeline: crate::datatypes::Utf8, - - /// Point-of-view entity. - /// - /// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - /// in the results returned by the range query. - pub pov_entity: crate::datatypes::EntityPath, - - /// Point-of-view component. - /// - /// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - /// in the results returned by the range query. - pub pov_component: crate::datatypes::Utf8, - - /// Beginning of the time range. - pub start: crate::datatypes::TimeInt, - - /// End of the time range (inclusive). - pub end: crate::datatypes::TimeInt, -} - -impl ::re_types_core::SizeBytes for TimeRangeQuery { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timeline.heap_size_bytes() - + self.pov_entity.heap_size_bytes() - + self.pov_component.heap_size_bytes() - + self.start.heap_size_bytes() - + self.end.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - && ::is_pod() - } -} - -::re_types_core::macros::impl_into_cow!(TimeRangeQuery); - -impl ::re_types_core::Loggable for TimeRangeQuery { - type Name = ::re_types_core::DatatypeName; - - #[inline] - fn name() -> Self::Name { - "rerun.blueprint.datatypes.TimeRangeQuery".into() - } - - #[inline] - fn arrow_datatype() -> arrow2::datatypes::DataType { - #![allow(clippy::wildcard_imports)] - use arrow2::datatypes::*; - DataType::Struct(std::sync::Arc::new(vec![ - Field::new( - "timeline", - ::arrow_datatype(), - false, - ), - Field::new( - "pov_entity", - ::arrow_datatype(), - false, - ), - Field::new( - "pov_component", - ::arrow_datatype(), - false, - ), - Field::new( - "start", - ::arrow_datatype(), - false, - ), - Field::new("end", ::arrow_datatype(), false), - ])) - } - - fn to_arrow_opt<'a>( - data: impl IntoIterator>>>, - ) -> SerializationResult> - where - Self: Clone + 'a, - { - #![allow(clippy::wildcard_imports)] - #![allow(clippy::manual_is_variant_and)] - use ::re_types_core::{Loggable as _, ResultExt as _}; - use arrow2::{array::*, datatypes::*}; - Ok({ - let (somes, data): (Vec<_>, Vec<_>) = data - .into_iter() - .map(|datum| { - let datum: Option<::std::borrow::Cow<'a, Self>> = datum.map(Into::into); - (datum.is_some(), datum) - }) - .unzip(); - let bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - StructArray::new( - Self::arrow_datatype(), - vec![ - { - let (somes, timeline): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.timeline.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let timeline_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - let offsets = arrow2::offset::Offsets::::try_from_lengths( - timeline.iter().map(|opt| { - opt.as_ref().map(|datum| datum.0.len()).unwrap_or_default() - }), - )? - .into(); - let inner_data: arrow2::buffer::Buffer = timeline - .into_iter() - .flatten() - .flat_map(|datum| datum.0 .0) - .collect(); - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - unsafe { - Utf8Array::::new_unchecked( - DataType::Utf8, - offsets, - inner_data, - timeline_bitmap, - ) - } - .boxed() - } - }, - { - let (somes, pov_entity): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.pov_entity.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let pov_entity_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - let offsets = arrow2::offset::Offsets::::try_from_lengths( - pov_entity.iter().map(|opt| { - opt.as_ref().map(|datum| datum.0.len()).unwrap_or_default() - }), - )? - .into(); - let inner_data: arrow2::buffer::Buffer = pov_entity - .into_iter() - .flatten() - .flat_map(|datum| datum.0 .0) - .collect(); - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - unsafe { - Utf8Array::::new_unchecked( - DataType::Utf8, - offsets, - inner_data, - pov_entity_bitmap, - ) - } - .boxed() - } - }, - { - let (somes, pov_component): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.pov_component.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let pov_component_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - { - let offsets = arrow2::offset::Offsets::::try_from_lengths( - pov_component.iter().map(|opt| { - opt.as_ref().map(|datum| datum.0.len()).unwrap_or_default() - }), - )? - .into(); - let inner_data: arrow2::buffer::Buffer = pov_component - .into_iter() - .flatten() - .flat_map(|datum| datum.0 .0) - .collect(); - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - unsafe { - Utf8Array::::new_unchecked( - DataType::Utf8, - offsets, - inner_data, - pov_component_bitmap, - ) - } - .boxed() - } - }, - { - let (somes, start): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.start.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let start_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - PrimitiveArray::new( - DataType::Int64, - start - .into_iter() - .map(|datum| datum.map(|datum| datum.0).unwrap_or_default()) - .collect(), - start_bitmap, - ) - .boxed() - }, - { - let (somes, end): (Vec<_>, Vec<_>) = data - .iter() - .map(|datum| { - let datum = datum.as_ref().map(|datum| datum.end.clone()); - (datum.is_some(), datum) - }) - .unzip(); - let end_bitmap: Option = { - let any_nones = somes.iter().any(|some| !*some); - any_nones.then(|| somes.into()) - }; - PrimitiveArray::new( - DataType::Int64, - end.into_iter() - .map(|datum| datum.map(|datum| datum.0).unwrap_or_default()) - .collect(), - end_bitmap, - ) - .boxed() - }, - ], - 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({ - let arrow_data = 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.datatypes.TimeRangeQuery")?; - if arrow_data.is_empty() { - Vec::new() - } else { - let (arrow_data_fields, arrow_data_arrays) = - (arrow_data.fields(), arrow_data.values()); - let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data_fields - .iter() - .map(|field| field.name.as_str()) - .zip(arrow_data_arrays) - .collect(); - let timeline = { - if !arrays_by_name.contains_key("timeline") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "timeline", - )) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery"); - } - let arrow_data = &**arrays_by_name["timeline"]; - { - let arrow_data = arrow_data - .as_any() - .downcast_ref::>() - .ok_or_else(|| { - let expected = DataType::Utf8; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#timeline")?; - let arrow_data_buf = arrow_data.values(); - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_buf.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = - unsafe { arrow_data_buf.clone().sliced_unchecked(start, len) }; - Ok(data) - }) - .transpose() - }) - .map(|res_or_opt| { - res_or_opt.map(|res_or_opt| { - res_or_opt.map(|v| { - crate::datatypes::Utf8(::re_types_core::ArrowString(v)) - }) - }) - }) - .collect::>>>() - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#timeline")? - .into_iter() - } - }; - let pov_entity = { - if !arrays_by_name.contains_key("pov_entity") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "pov_entity", - )) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery"); - } - let arrow_data = &**arrays_by_name["pov_entity"]; - { - let arrow_data = arrow_data - .as_any() - .downcast_ref::>() - .ok_or_else(|| { - let expected = DataType::Utf8; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#pov_entity")?; - let arrow_data_buf = arrow_data.values(); - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_buf.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = - unsafe { arrow_data_buf.clone().sliced_unchecked(start, len) }; - Ok(data) - }) - .transpose() - }) - .map(|res_or_opt| { - res_or_opt.map(|res_or_opt| { - res_or_opt.map(|v| { - crate::datatypes::EntityPath(::re_types_core::ArrowString(v)) - }) - }) - }) - .collect::>>>() - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#pov_entity")? - .into_iter() - } - }; - let pov_component = { - if !arrays_by_name.contains_key("pov_component") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "pov_component", - )) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery"); - } - let arrow_data = &**arrays_by_name["pov_component"]; - { - let arrow_data = arrow_data - .as_any() - .downcast_ref::>() - .ok_or_else(|| { - let expected = DataType::Utf8; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context( - "rerun.blueprint.datatypes.TimeRangeQuery#pov_component", - )?; - let arrow_data_buf = arrow_data.values(); - let offsets = arrow_data.offsets(); - arrow2::bitmap::utils::ZipValidity::new_with_validity( - offsets.iter().zip(offsets.lengths()), - arrow_data.validity(), - ) - .map(|elem| { - elem.map(|(start, len)| { - let start = *start as usize; - let end = start + len; - if end > arrow_data_buf.len() { - return Err(DeserializationError::offset_slice_oob( - (start, end), - arrow_data_buf.len(), - )); - } - - #[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] - let data = - unsafe { arrow_data_buf.clone().sliced_unchecked(start, len) }; - Ok(data) - }) - .transpose() - }) - .map(|res_or_opt| { - res_or_opt.map(|res_or_opt| { - res_or_opt.map(|v| { - crate::datatypes::Utf8(::re_types_core::ArrowString(v)) - }) - }) - }) - .collect::>>>() - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#pov_component")? - .into_iter() - } - }; - let start = { - if !arrays_by_name.contains_key("start") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "start", - )) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery"); - } - let arrow_data = &**arrays_by_name["start"]; - arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = DataType::Int64; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#start")? - .into_iter() - .map(|opt| opt.copied()) - .map(|res_or_opt| res_or_opt.map(crate::datatypes::TimeInt)) - }; - let end = { - if !arrays_by_name.contains_key("end") { - return Err(DeserializationError::missing_struct_field( - Self::arrow_datatype(), - "end", - )) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery"); - } - let arrow_data = &**arrays_by_name["end"]; - arrow_data - .as_any() - .downcast_ref::() - .ok_or_else(|| { - let expected = DataType::Int64; - let actual = arrow_data.data_type().clone(); - DeserializationError::datatype_mismatch(expected, actual) - }) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#end")? - .into_iter() - .map(|opt| opt.copied()) - .map(|res_or_opt| res_or_opt.map(crate::datatypes::TimeInt)) - }; - arrow2::bitmap::utils::ZipValidity::new_with_validity( - ::itertools::izip!(timeline, pov_entity, pov_component, start, end), - arrow_data.validity(), - ) - .map(|opt| { - opt.map(|(timeline, pov_entity, pov_component, start, end)| { - Ok(Self { - timeline: timeline - .ok_or_else(DeserializationError::missing_data) - .with_context( - "rerun.blueprint.datatypes.TimeRangeQuery#timeline", - )?, - pov_entity: pov_entity - .ok_or_else(DeserializationError::missing_data) - .with_context( - "rerun.blueprint.datatypes.TimeRangeQuery#pov_entity", - )?, - pov_component: pov_component - .ok_or_else(DeserializationError::missing_data) - .with_context( - "rerun.blueprint.datatypes.TimeRangeQuery#pov_component", - )?, - start: start - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#start")?, - end: end - .ok_or_else(DeserializationError::missing_data) - .with_context("rerun.blueprint.datatypes.TimeRangeQuery#end")?, - }) - }) - .transpose() - }) - .collect::>>() - .with_context("rerun.blueprint.datatypes.TimeRangeQuery")? - } - }) - } -} diff --git a/crates/store/re_types/src/blueprint/datatypes/time_range_query_ext.rs b/crates/store/re_types/src/blueprint/datatypes/time_range_query_ext.rs deleted file mode 100644 index b314520b7022..000000000000 --- a/crates/store/re_types/src/blueprint/datatypes/time_range_query_ext.rs +++ /dev/null @@ -1,14 +0,0 @@ -use super::TimeRangeQuery; -use re_types_core::datatypes::{TimeInt, Utf8}; - -impl Default for TimeRangeQuery { - fn default() -> Self { - Self { - timeline: Utf8::from("log_time"), - pov_entity: Default::default(), - pov_component: Default::default(), - start: TimeInt::MIN, - end: TimeInt::MAX, - } - } -} 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 c8496ca62280..70241e2a38a6 100644 --- a/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs +++ b/crates/viewer/re_viewer/src/blueprint/validation_gen/mod.rs @@ -11,17 +11,14 @@ pub use re_types::blueprint::components::FilterByEvent; pub use re_types::blueprint::components::FilterByRange; pub use re_types::blueprint::components::IncludedContent; pub use re_types::blueprint::components::Interactive; -pub use re_types::blueprint::components::LatestAtQueries; pub use re_types::blueprint::components::LockRangeDuringZoom; 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::SelectedColumns; pub use re_types::blueprint::components::SpaceViewClass; pub use re_types::blueprint::components::SpaceViewOrigin; pub use re_types::blueprint::components::TensorDimensionIndexSlider; -pub use re_types::blueprint::components::TimeRangeQueries; pub use re_types::blueprint::components::TimelineName; pub use re_types::blueprint::components::ViewFit; pub use re_types::blueprint::components::ViewerRecommendationHash; @@ -56,11 +53,9 @@ 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) && validate_component::(blueprint) && validate_component::(blueprint) && validate_component::(blueprint) @@ -68,7 +63,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) diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index a16bfbfcb590..fb239a4d987e 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -139,13 +139,6 @@ fn generate_component_reflection() -> Result::name(), - ComponentReflection { - docstring_md: "Configuration for latest-at queries.\n\nNote: configuration as saved on a per-timeline basis.", - placeholder: Some(LatestAtQueries::default().to_arrow()?), - }, - ), ( ::name(), ComponentReflection { @@ -167,13 +160,6 @@ fn generate_component_reflection() -> Result::name(), - ComponentReflection { - docstring_md: "The kind of query displayed by the dataframe view", - placeholder: Some(QueryKind::default().to_arrow()?), - }, - ), ( ::name(), ComponentReflection { @@ -223,13 +209,6 @@ fn generate_component_reflection() -> Result::name(), - ComponentReflection { - docstring_md: "Configuration for time range queries.\n\nNote: configuration as saved on a per-timeline basis.", - placeholder: Some(TimeRangeQueries::default().to_arrow()?), - }, - ), ( ::name(), ComponentReflection { @@ -1578,30 +1557,6 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { ], }, ), - ( - ArchetypeName::new("rerun.blueprint.archetypes.DataframeQuery"), - ArchetypeReflection { - display_name: "Dataframe query", - fields: vec![ - ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.TimelineName".into(), display_name : - "Timeline", docstring_md : - "The timeline for this query.\n\nIf unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.QueryKind".into(), display_name : "Kind", - docstring_md : "Kind of query: latest-at or range.", is_required : - false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.LatestAtQueries".into(), display_name : - "Latest at queries", docstring_md : - "Configuration for latest-at queries.\n\nNote: configuration as saved on a per-timeline basis.", - is_required : false, }, ArchetypeFieldReflection { component_name : - "rerun.blueprint.components.TimeRangeQueries".into(), display_name : - "Time range queries", docstring_md : - "Configuration for the time range queries.\n\nNote: configuration as saved on a per-timeline basis.", - is_required : false, }, - ], - }, - ), ( ArchetypeName::new("rerun.blueprint.archetypes.DataframeQueryV2"), ArchetypeReflection { diff --git a/rerun_cpp/src/rerun/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/archetypes.hpp index 3915908e6432..06112024611b 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -4,7 +4,6 @@ #include "blueprint/archetypes/background.hpp" #include "blueprint/archetypes/container_blueprint.hpp" -#include "blueprint/archetypes/dataframe_query.hpp" #include "blueprint/archetypes/dataframe_query_v2.hpp" #include "blueprint/archetypes/panel_blueprint.hpp" #include "blueprint/archetypes/plot_legend.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes index c4a06635d4c0..f35709bd8af0 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -5,8 +5,6 @@ background.cpp linguist-generated=true background.hpp linguist-generated=true container_blueprint.cpp linguist-generated=true container_blueprint.hpp linguist-generated=true -dataframe_query.cpp linguist-generated=true -dataframe_query.hpp linguist-generated=true dataframe_query_v2.cpp linguist-generated=true dataframe_query_v2.hpp linguist-generated=true panel_blueprint.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp deleted file mode 100644 index 0bd53a79fd93..000000000000 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp +++ /dev/null @@ -1,49 +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/dataframe_query.fbs". - -#include "dataframe_query.hpp" - -#include "../../collection_adapter_builtins.hpp" - -namespace rerun::blueprint::archetypes {} - -namespace rerun { - - Result> - AsComponents::serialize( - const blueprint::archetypes::DataframeQuery& archetype - ) { - using namespace blueprint::archetypes; - std::vector cells; - cells.reserve(5); - - if (archetype.timeline.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.timeline.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.kind.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.kind.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.latest_at_queries.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.latest_at_queries.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.time_range_queries.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.time_range_queries.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - { - auto indicator = DataframeQuery::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/dataframe_query.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp deleted file mode 100644 index 696a4ca139d1..000000000000 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp +++ /dev/null @@ -1,107 +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/dataframe_query.fbs". - -#pragma once - -#include "../../blueprint/components/latest_at_queries.hpp" -#include "../../blueprint/components/query_kind.hpp" -#include "../../blueprint/components/time_range_queries.hpp" -#include "../../blueprint/components/timeline_name.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**: The query for the dataframe view. - struct DataframeQuery { - /// The timeline for this query. - /// - /// If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - std::optional timeline; - - /// Kind of query: latest-at or range. - std::optional kind; - - /// Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. - std::optional latest_at_queries; - - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - std::optional time_range_queries; - - public: - static constexpr const char IndicatorComponentName[] = - "rerun.blueprint.components.DataframeQueryIndicator"; - - /// Indicator component, used to identify the archetype when converting to a list of components. - using IndicatorComponent = rerun::components::IndicatorComponent; - - public: - DataframeQuery() = default; - DataframeQuery(DataframeQuery&& other) = default; - - /// The timeline for this query. - /// - /// If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - DataframeQuery with_timeline(rerun::blueprint::components::TimelineName _timeline) && { - timeline = std::move(_timeline); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// Kind of query: latest-at or range. - DataframeQuery with_kind(rerun::blueprint::components::QueryKind _kind) && { - kind = std::move(_kind); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. - DataframeQuery with_latest_at_queries( - rerun::blueprint::components::LatestAtQueries _latest_at_queries - ) && { - latest_at_queries = std::move(_latest_at_queries); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - DataframeQuery with_time_range_queries( - rerun::blueprint::components::TimeRangeQueries _time_range_queries - ) && { - time_range_queries = std::move(_time_range_queries); - // 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::DataframeQuery& archetype - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components.hpp b/rerun_cpp/src/rerun/blueprint/components.hpp index fe7c63c22b40..c6c37676acaf 100644 --- a/rerun_cpp/src/rerun/blueprint/components.hpp +++ b/rerun_cpp/src/rerun/blueprint/components.hpp @@ -17,11 +17,9 @@ #include "blueprint/components/included_content.hpp" #include "blueprint/components/included_space_view.hpp" #include "blueprint/components/interactive.hpp" -#include "blueprint/components/latest_at_queries.hpp" #include "blueprint/components/lock_range_during_zoom.hpp" #include "blueprint/components/panel_state.hpp" #include "blueprint/components/query_expression.hpp" -#include "blueprint/components/query_kind.hpp" #include "blueprint/components/root_container.hpp" #include "blueprint/components/row_share.hpp" #include "blueprint/components/selected_columns.hpp" @@ -29,7 +27,6 @@ #include "blueprint/components/space_view_maximized.hpp" #include "blueprint/components/space_view_origin.hpp" #include "blueprint/components/tensor_dimension_index_slider.hpp" -#include "blueprint/components/time_range_queries.hpp" #include "blueprint/components/timeline_name.hpp" #include "blueprint/components/view_fit.hpp" #include "blueprint/components/viewer_recommendation_hash.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/components/.gitattributes b/rerun_cpp/src/rerun/blueprint/components/.gitattributes index ce4345c5411a..67aaefd41394 100644 --- a/rerun_cpp/src/rerun/blueprint/components/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/components/.gitattributes @@ -19,14 +19,10 @@ grid_columns.hpp linguist-generated=true included_content.hpp linguist-generated=true included_space_view.hpp linguist-generated=true interactive.hpp linguist-generated=true -latest_at_queries.cpp linguist-generated=true -latest_at_queries.hpp linguist-generated=true lock_range_during_zoom.hpp linguist-generated=true panel_state.cpp linguist-generated=true panel_state.hpp linguist-generated=true query_expression.hpp linguist-generated=true -query_kind.cpp linguist-generated=true -query_kind.hpp linguist-generated=true root_container.hpp linguist-generated=true row_share.hpp linguist-generated=true selected_columns.hpp linguist-generated=true @@ -34,8 +30,6 @@ space_view_class.hpp linguist-generated=true space_view_maximized.hpp linguist-generated=true space_view_origin.hpp linguist-generated=true tensor_dimension_index_slider.hpp linguist-generated=true -time_range_queries.cpp linguist-generated=true -time_range_queries.hpp linguist-generated=true timeline_name.hpp linguist-generated=true view_fit.cpp linguist-generated=true view_fit.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/components/latest_at_queries.cpp b/rerun_cpp/src/rerun/blueprint/components/latest_at_queries.cpp deleted file mode 100644 index 6f951ad7fb76..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/latest_at_queries.cpp +++ /dev/null @@ -1,81 +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/latest_at_queries.fbs". - -#include "latest_at_queries.hpp" - -#include "../../blueprint/datatypes/latest_at_query.hpp" - -#include -#include - -namespace rerun::blueprint::components {} - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::list(arrow::field( - "item", - Loggable::arrow_datatype(), - false - )); - return datatype; - } - - Result> - Loggable::to_arrow( - const blueprint::components::LatestAtQueries* 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::ListBuilder* builder, const blueprint::components::LatestAtQueries* 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." - ); - } - - auto value_builder = static_cast(builder->value_builder()); - ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(builder->Append()); - if (element.queries.data()) { - RR_RETURN_NOT_OK( - Loggable::fill_arrow_array_builder( - value_builder, - element.queries.data(), - element.queries.size() - ) - ); - } - } - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/latest_at_queries.hpp b/rerun_cpp/src/rerun/blueprint/components/latest_at_queries.hpp deleted file mode 100644 index 1b2e5fda1665..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/latest_at_queries.hpp +++ /dev/null @@ -1,65 +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/latest_at_queries.fbs". - -#pragma once - -#include "../../blueprint/datatypes/latest_at_query.hpp" -#include "../../collection.hpp" -#include "../../result.hpp" - -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class ListBuilder; -} // namespace arrow - -namespace rerun::blueprint::components { - /// **Component**: Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. - struct LatestAtQueries { - rerun::Collection queries; - - public: - LatestAtQueries() = default; - - LatestAtQueries(rerun::Collection queries_) - : queries(std::move(queries_)) {} - - LatestAtQueries& operator=( - rerun::Collection queries_ - ) { - queries = std::move(queries_); - return *this; - } - }; -} // namespace rerun::blueprint::components - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.components.LatestAtQueries"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: components::LatestAtQueries` into an arrow array. - static Result> to_arrow( - const blueprint::components::LatestAtQueries* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::ListBuilder* builder, const blueprint::components::LatestAtQueries* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/query_kind.cpp b/rerun_cpp/src/rerun/blueprint/components/query_kind.cpp deleted file mode 100644 index a6e0297f884e..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/query_kind.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/query_kind.fbs". - -#include "query_kind.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::QueryKind* 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::QueryKind* 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/query_kind.hpp b/rerun_cpp/src/rerun/blueprint/components/query_kind.hpp deleted file mode 100644 index 83ada16ad531..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/query_kind.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/query_kind.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**: The kind of query displayed by the dataframe view - enum class QueryKind : uint8_t { - - /// Query - LatestAt = 1, - - /// Time range query. - TimeRange = 2, - }; -} // namespace rerun::blueprint::components - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.components.QueryKind"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: components::QueryKind` into an arrow array. - static Result> to_arrow( - const blueprint::components::QueryKind* 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::QueryKind* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/time_range_queries.cpp b/rerun_cpp/src/rerun/blueprint/components/time_range_queries.cpp deleted file mode 100644 index 924d17db7a1c..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/time_range_queries.cpp +++ /dev/null @@ -1,81 +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/time_range_queries.fbs". - -#include "time_range_queries.hpp" - -#include "../../blueprint/datatypes/time_range_query.hpp" - -#include -#include - -namespace rerun::blueprint::components {} - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::list(arrow::field( - "item", - Loggable::arrow_datatype(), - false - )); - return datatype; - } - - Result> - Loggable::to_arrow( - const blueprint::components::TimeRangeQueries* 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::ListBuilder* builder, const blueprint::components::TimeRangeQueries* 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." - ); - } - - auto value_builder = static_cast(builder->value_builder()); - ARROW_RETURN_NOT_OK(builder->Reserve(static_cast(num_elements))); - ARROW_RETURN_NOT_OK(value_builder->Reserve(static_cast(num_elements * 2))); - - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - const auto& element = elements[elem_idx]; - ARROW_RETURN_NOT_OK(builder->Append()); - if (element.queries.data()) { - RR_RETURN_NOT_OK( - Loggable::fill_arrow_array_builder( - value_builder, - element.queries.data(), - element.queries.size() - ) - ); - } - } - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/components/time_range_queries.hpp b/rerun_cpp/src/rerun/blueprint/components/time_range_queries.hpp deleted file mode 100644 index 4ecee518f49b..000000000000 --- a/rerun_cpp/src/rerun/blueprint/components/time_range_queries.hpp +++ /dev/null @@ -1,65 +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/time_range_queries.fbs". - -#pragma once - -#include "../../blueprint/datatypes/time_range_query.hpp" -#include "../../collection.hpp" -#include "../../result.hpp" - -#include -#include -#include - -namespace arrow { - class Array; - class DataType; - class ListBuilder; -} // namespace arrow - -namespace rerun::blueprint::components { - /// **Component**: Configuration for time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - struct TimeRangeQueries { - rerun::Collection queries; - - public: - TimeRangeQueries() = default; - - TimeRangeQueries(rerun::Collection queries_) - : queries(std::move(queries_)) {} - - TimeRangeQueries& operator=( - rerun::Collection queries_ - ) { - queries = std::move(queries_); - return *this; - } - }; -} // namespace rerun::blueprint::components - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.components.TimeRangeQueries"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: components::TimeRangeQueries` into an arrow array. - static Result> to_arrow( - const blueprint::components::TimeRangeQueries* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::ListBuilder* builder, const blueprint::components::TimeRangeQueries* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes.hpp b/rerun_cpp/src/rerun/blueprint/datatypes.hpp index ed0d71e77a6d..355120a6b884 100644 --- a/rerun_cpp/src/rerun/blueprint/datatypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/datatypes.hpp @@ -5,8 +5,6 @@ #include "blueprint/datatypes/component_column_selector.hpp" #include "blueprint/datatypes/filter_by_event.hpp" #include "blueprint/datatypes/filter_by_range.hpp" -#include "blueprint/datatypes/latest_at_query.hpp" #include "blueprint/datatypes/selected_columns.hpp" #include "blueprint/datatypes/tensor_dimension_index_slider.hpp" -#include "blueprint/datatypes/time_range_query.hpp" #include "blueprint/datatypes/utf8list.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes index 581c403c6798..03771d4a87e5 100644 --- a/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/datatypes/.gitattributes @@ -7,13 +7,9 @@ filter_by_event.cpp linguist-generated=true filter_by_event.hpp linguist-generated=true filter_by_range.cpp linguist-generated=true filter_by_range.hpp linguist-generated=true -latest_at_query.cpp linguist-generated=true -latest_at_query.hpp linguist-generated=true selected_columns.cpp linguist-generated=true selected_columns.hpp linguist-generated=true tensor_dimension_index_slider.cpp linguist-generated=true tensor_dimension_index_slider.hpp linguist-generated=true -time_range_query.cpp linguist-generated=true -time_range_query.hpp linguist-generated=true utf8list.cpp linguist-generated=true utf8list.hpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.cpp b/rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.cpp deleted file mode 100644 index 490f5df72cd9..000000000000 --- a/rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.cpp +++ /dev/null @@ -1,86 +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/datatypes/latest_at_query.fbs". - -#include "latest_at_query.hpp" - -#include "../../datatypes/time_int.hpp" -#include "../../datatypes/utf8.hpp" - -#include -#include - -namespace rerun::blueprint::datatypes {} - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::struct_({ - arrow::field("timeline", Loggable::arrow_datatype(), false), - arrow::field("time", Loggable::arrow_datatype(), false), - }); - return datatype; - } - - Result> Loggable::to_arrow( - const blueprint::datatypes::LatestAtQuery* 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::StructBuilder* builder, const blueprint::datatypes::LatestAtQuery* 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." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].timeline, - 1 - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(1)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].time, - 1 - )); - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.hpp b/rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.hpp deleted file mode 100644 index 49cc63cf4a10..000000000000 --- a/rerun_cpp/src/rerun/blueprint/datatypes/latest_at_query.hpp +++ /dev/null @@ -1,56 +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/datatypes/latest_at_query.fbs". - -#pragma once - -#include "../../datatypes/time_int.hpp" -#include "../../datatypes/utf8.hpp" -#include "../../result.hpp" - -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint::datatypes { - /// **Datatype**: Latest-at query configuration for a specific timeline. - struct LatestAtQuery { - /// Name of the timeline this applies to. - rerun::datatypes::Utf8 timeline; - - /// Time value to use for this query. - rerun::datatypes::TimeInt time; - - public: - LatestAtQuery() = default; - }; -} // namespace rerun::blueprint::datatypes - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.datatypes.LatestAtQuery"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: datatypes::LatestAtQuery` into an arrow array. - static Result> to_arrow( - const blueprint::datatypes::LatestAtQuery* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::datatypes::LatestAtQuery* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.cpp b/rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.cpp deleted file mode 100644 index 725277cc81c9..000000000000 --- a/rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.cpp +++ /dev/null @@ -1,131 +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/datatypes/time_range_query.fbs". - -#include "time_range_query.hpp" - -#include "../../datatypes/entity_path.hpp" -#include "../../datatypes/time_int.hpp" -#include "../../datatypes/utf8.hpp" - -#include -#include - -namespace rerun::blueprint::datatypes {} - -namespace rerun { - const std::shared_ptr& - Loggable::arrow_datatype() { - static const auto datatype = arrow::struct_({ - arrow::field("timeline", Loggable::arrow_datatype(), false), - arrow::field( - "pov_entity", - Loggable::arrow_datatype(), - false - ), - arrow::field( - "pov_component", - Loggable::arrow_datatype(), - false - ), - arrow::field("start", Loggable::arrow_datatype(), false), - arrow::field("end", Loggable::arrow_datatype(), false), - }); - return datatype; - } - - Result> Loggable::to_arrow( - const blueprint::datatypes::TimeRangeQuery* 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::StructBuilder* builder, const blueprint::datatypes::TimeRangeQuery* 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." - ); - } - - { - auto field_builder = static_cast(builder->field_builder(0)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].timeline, - 1 - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(1)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].pov_entity, - 1 - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(2)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].pov_component, - 1 - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(3)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].start, - 1 - )); - } - } - { - auto field_builder = static_cast(builder->field_builder(4)); - ARROW_RETURN_NOT_OK(field_builder->Reserve(static_cast(num_elements))); - for (size_t elem_idx = 0; elem_idx < num_elements; elem_idx += 1) { - RR_RETURN_NOT_OK(Loggable::fill_arrow_array_builder( - field_builder, - &elements[elem_idx].end, - 1 - )); - } - } - ARROW_RETURN_NOT_OK(builder->AppendValues(static_cast(num_elements), nullptr)); - - return Error::ok(); - } -} // namespace rerun diff --git a/rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.hpp b/rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.hpp deleted file mode 100644 index 9930d75945fd..000000000000 --- a/rerun_cpp/src/rerun/blueprint/datatypes/time_range_query.hpp +++ /dev/null @@ -1,72 +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/datatypes/time_range_query.fbs". - -#pragma once - -#include "../../datatypes/entity_path.hpp" -#include "../../datatypes/time_int.hpp" -#include "../../datatypes/utf8.hpp" -#include "../../result.hpp" - -#include -#include - -namespace arrow { - class Array; - class DataType; - class StructBuilder; -} // namespace arrow - -namespace rerun::blueprint::datatypes { - /// **Datatype**: Time range query configuration for a specific timeline. - struct TimeRangeQuery { - /// Name of the timeline this applies to. - rerun::datatypes::Utf8 timeline; - - /// Point-of-view entity. - /// - /// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - /// in the results returned by the range query. - rerun::datatypes::EntityPath pov_entity; - - /// Point-of-view component. - /// - /// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - /// in the results returned by the range query. - rerun::datatypes::Utf8 pov_component; - - /// Beginning of the time range. - rerun::datatypes::TimeInt start; - - /// End of the time range (inclusive). - rerun::datatypes::TimeInt end; - - public: - TimeRangeQuery() = default; - }; -} // namespace rerun::blueprint::datatypes - -namespace rerun { - template - struct Loggable; - - /// \private - template <> - struct Loggable { - static constexpr const char Name[] = "rerun.blueprint.datatypes.TimeRangeQuery"; - - /// Returns the arrow data type this type corresponds to. - static const std::shared_ptr& arrow_datatype(); - - /// Serializes an array of `rerun::blueprint:: datatypes::TimeRangeQuery` into an arrow array. - static Result> to_arrow( - const blueprint::datatypes::TimeRangeQuery* instances, size_t num_instances - ); - - /// Fills an arrow array builder with an array of this type. - static rerun::Error fill_arrow_array_builder( - arrow::StructBuilder* builder, const blueprint::datatypes::TimeRangeQuery* elements, - size_t num_elements - ); - }; -} // namespace rerun diff --git a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py index 8ec8a0cc53ce..0da791c5fb26 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/__init__.py @@ -29,7 +29,6 @@ ) from .archetypes import ( Background as Background, - DataframeQuery as DataframeQuery, PlotLegend as PlotLegend, ScalarAxis as ScalarAxis, TensorScalarMapping as TensorScalarMapping, @@ -41,8 +40,6 @@ BackgroundKind as BackgroundKind, Corner2D as Corner2D, LockRangeDuringZoom as LockRangeDuringZoom, - QueryKind as QueryKind, - TimeRangeQueries as TimeRangeQueries, VisibleTimeRange as VisibleTimeRange, VisualizerOverrides as VisualizerOverrides, ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes index 3916525a8bcd..40fce6cf7f44 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -4,7 +4,6 @@ __init__.py linguist-generated=true background.py linguist-generated=true container_blueprint.py linguist-generated=true -dataframe_query.py linguist-generated=true dataframe_query_v2.py linguist-generated=true panel_blueprint.py linguist-generated=true plot_legend.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 2eefb2ec1ef0..497b4e9dfe10 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -4,7 +4,6 @@ from .background import Background from .container_blueprint import ContainerBlueprint -from .dataframe_query import DataframeQuery from .dataframe_query_v2 import DataframeQueryV2 from .panel_blueprint import PanelBlueprint from .plot_legend import PlotLegend @@ -21,7 +20,6 @@ __all__ = [ "Background", "ContainerBlueprint", - "DataframeQuery", "DataframeQueryV2", "PanelBlueprint", "PlotLegend", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py deleted file mode 100644 index dec9b487e8e0..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py +++ /dev/null @@ -1,123 +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/dataframe_query.fbs". - -# You can extend this class by creating a "DataframeQueryExt" class in "dataframe_query_ext.py". - -from __future__ import annotations - -from typing import Any - -from attrs import define, field - -from ... import datatypes -from ..._baseclasses import ( - Archetype, -) -from ...blueprint import components as blueprint_components -from ...error_utils import catch_and_log_exceptions - -__all__ = ["DataframeQuery"] - - -@define(str=False, repr=False, init=False) -class DataframeQuery(Archetype): - """**Archetype**: The query for the dataframe view.""" - - def __init__( - self: Any, - *, - timeline: datatypes.Utf8Like | None = None, - kind: blueprint_components.QueryKindLike | None = None, - latest_at_queries: blueprint_components.LatestAtQueriesLike | None = None, - time_range_queries: blueprint_components.TimeRangeQueriesLike | None = None, - ): - """ - Create a new instance of the DataframeQuery archetype. - - Parameters - ---------- - timeline: - The timeline for this query. - - If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - kind: - Kind of query: latest-at or range. - latest_at_queries: - Configuration for latest-at queries. - - Note: configuration as saved on a per-timeline basis. - time_range_queries: - Configuration for the time range queries. - - Note: configuration as saved on a per-timeline basis. - - """ - - # You can define your own __init__ function as a member of DataframeQueryExt in dataframe_query_ext.py - with catch_and_log_exceptions(context=self.__class__.__name__): - self.__attrs_init__( - timeline=timeline, kind=kind, latest_at_queries=latest_at_queries, time_range_queries=time_range_queries - ) - return - self.__attrs_clear__() - - def __attrs_clear__(self) -> None: - """Convenience method for calling `__attrs_init__` with all `None`s.""" - self.__attrs_init__( - timeline=None, # type: ignore[arg-type] - kind=None, # type: ignore[arg-type] - latest_at_queries=None, # type: ignore[arg-type] - time_range_queries=None, # type: ignore[arg-type] - ) - - @classmethod - def _clear(cls) -> DataframeQuery: - """Produce an empty DataframeQuery, bypassing `__init__`.""" - inst = cls.__new__(cls) - inst.__attrs_clear__() - return inst - - timeline: blueprint_components.TimelineNameBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.TimelineNameBatch._optional, # type: ignore[misc] - ) - # The timeline for this query. - # - # If unset, use the time panel's timeline and a latest-at query, ignoring all other components of this archetype. - # - # (Docstring intentionally commented out to hide this field from the docs) - - kind: blueprint_components.QueryKindBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.QueryKindBatch._optional, # type: ignore[misc] - ) - # Kind of query: latest-at or range. - # - # (Docstring intentionally commented out to hide this field from the docs) - - latest_at_queries: blueprint_components.LatestAtQueriesBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.LatestAtQueriesBatch._optional, # type: ignore[misc] - ) - # Configuration for latest-at queries. - # - # Note: configuration as saved on a per-timeline basis. - # - # (Docstring intentionally commented out to hide this field from the docs) - - time_range_queries: blueprint_components.TimeRangeQueriesBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.TimeRangeQueriesBatch._optional, # type: ignore[misc] - ) - # Configuration for the time range queries. - # - # Note: configuration as saved on a per-timeline basis. - # - # (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 5692a1eb3387..eaac9c666765 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/.gitattributes @@ -17,11 +17,9 @@ grid_columns.py linguist-generated=true included_content.py linguist-generated=true included_space_view.py linguist-generated=true interactive.py linguist-generated=true -latest_at_queries.py linguist-generated=true lock_range_during_zoom.py linguist-generated=true panel_state.py linguist-generated=true query_expression.py linguist-generated=true -query_kind.py linguist-generated=true root_container.py linguist-generated=true row_share.py linguist-generated=true selected_columns.py linguist-generated=true @@ -29,7 +27,6 @@ space_view_class.py linguist-generated=true space_view_maximized.py linguist-generated=true space_view_origin.py linguist-generated=true tensor_dimension_index_slider.py linguist-generated=true -time_range_queries.py linguist-generated=true timeline_name.py linguist-generated=true view_fit.py linguist-generated=true viewer_recommendation_hash.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 c6ccb3687857..34470e1adc20 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/components/__init__.py @@ -33,17 +33,9 @@ from .included_content import IncludedContent, IncludedContentBatch, IncludedContentType from .included_space_view import IncludedSpaceView, IncludedSpaceViewBatch, IncludedSpaceViewType from .interactive import Interactive, InteractiveBatch, InteractiveType -from .latest_at_queries import ( - LatestAtQueries, - LatestAtQueriesArrayLike, - LatestAtQueriesBatch, - LatestAtQueriesLike, - LatestAtQueriesType, -) from .lock_range_during_zoom import LockRangeDuringZoom, LockRangeDuringZoomBatch, LockRangeDuringZoomType from .panel_state import PanelState, PanelStateArrayLike, PanelStateBatch, PanelStateLike, PanelStateType from .query_expression import QueryExpression, QueryExpressionBatch, QueryExpressionType -from .query_kind import QueryKind, QueryKindArrayLike, QueryKindBatch, QueryKindLike, QueryKindType from .root_container import RootContainer, RootContainerBatch, RootContainerType from .row_share import RowShare, RowShareBatch, RowShareType from .selected_columns import SelectedColumns, SelectedColumnsBatch, SelectedColumnsType @@ -55,13 +47,6 @@ TensorDimensionIndexSliderBatch, TensorDimensionIndexSliderType, ) -from .time_range_queries import ( - TimeRangeQueries, - TimeRangeQueriesArrayLike, - TimeRangeQueriesBatch, - TimeRangeQueriesLike, - TimeRangeQueriesType, -) from .timeline_name import TimelineName, TimelineNameBatch, TimelineNameType from .view_fit import ViewFit, ViewFitArrayLike, ViewFitBatch, ViewFitLike, ViewFitType from .viewer_recommendation_hash import ( @@ -126,11 +111,6 @@ "Interactive", "InteractiveBatch", "InteractiveType", - "LatestAtQueries", - "LatestAtQueriesArrayLike", - "LatestAtQueriesBatch", - "LatestAtQueriesLike", - "LatestAtQueriesType", "LockRangeDuringZoom", "LockRangeDuringZoomBatch", "LockRangeDuringZoomType", @@ -142,11 +122,6 @@ "QueryExpression", "QueryExpressionBatch", "QueryExpressionType", - "QueryKind", - "QueryKindArrayLike", - "QueryKindBatch", - "QueryKindLike", - "QueryKindType", "RootContainer", "RootContainerBatch", "RootContainerType", @@ -168,11 +143,6 @@ "TensorDimensionIndexSlider", "TensorDimensionIndexSliderBatch", "TensorDimensionIndexSliderType", - "TimeRangeQueries", - "TimeRangeQueriesArrayLike", - "TimeRangeQueriesBatch", - "TimeRangeQueriesLike", - "TimeRangeQueriesType", "TimelineName", "TimelineNameBatch", "TimelineNameType", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/latest_at_queries.py b/rerun_py/rerun_sdk/rerun/blueprint/components/latest_at_queries.py deleted file mode 100644 index 357a291751f4..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/latest_at_queries.py +++ /dev/null @@ -1,88 +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/latest_at_queries.fbs". - -# You can extend this class by creating a "LatestAtQueriesExt" class in "latest_at_queries_ext.py". - -from __future__ import annotations - -from typing import Any, Sequence, Union - -import pyarrow as pa -from attrs import define, field - -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, - ComponentBatchMixin, - ComponentMixin, -) -from ...blueprint import datatypes as blueprint_datatypes - -__all__ = [ - "LatestAtQueries", - "LatestAtQueriesArrayLike", - "LatestAtQueriesBatch", - "LatestAtQueriesLike", - "LatestAtQueriesType", -] - - -@define(init=False) -class LatestAtQueries(ComponentMixin): - """ - **Component**: Configuration for latest-at queries. - - Note: configuration as saved on a per-timeline basis. - """ - - _BATCH_TYPE = None - - def __init__(self: Any, queries: LatestAtQueriesLike): - """Create a new instance of the LatestAtQueries component.""" - - # You can define your own __init__ function as a member of LatestAtQueriesExt in latest_at_queries_ext.py - self.__attrs_init__(queries=queries) - - queries: list[blueprint_datatypes.LatestAtQuery] = field() - - -LatestAtQueriesLike = LatestAtQueries -LatestAtQueriesArrayLike = Union[ - LatestAtQueries, - Sequence[LatestAtQueriesLike], -] - - -class LatestAtQueriesType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.components.LatestAtQueries" - - def __init__(self) -> None: - pa.ExtensionType.__init__( - self, - pa.list_( - pa.field( - "item", - pa.struct([ - pa.field("timeline", pa.utf8(), nullable=False, metadata={}), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ]), - nullable=False, - metadata={}, - ) - ), - self._TYPE_NAME, - ) - - -class LatestAtQueriesBatch(BaseBatch[LatestAtQueriesArrayLike], ComponentBatchMixin): - _ARROW_TYPE = LatestAtQueriesType() - - @staticmethod - def _native_to_pa_array(data: LatestAtQueriesArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError( - "Arrow serialization of LatestAtQueries not implemented: We lack codegen for arrow-serialization of general structs" - ) # You need to implement native_to_pa_array_override in latest_at_queries_ext.py - - -# This is patched in late to avoid circular dependencies. -LatestAtQueries._BATCH_TYPE = LatestAtQueriesBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/components/query_kind.py b/rerun_py/rerun_sdk/rerun/blueprint/components/query_kind.py deleted file mode 100644 index cd8e452fb9e2..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/query_kind.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/query_kind.fbs". - -# You can extend this class by creating a "QueryKindExt" class in "query_kind_ext.py". - -from __future__ import annotations - -from typing import Literal, Sequence, Union - -import pyarrow as pa - -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, - ComponentBatchMixin, -) - -__all__ = ["QueryKind", "QueryKindArrayLike", "QueryKindBatch", "QueryKindLike", "QueryKindType"] - - -from enum import Enum - - -class QueryKind(Enum): - """**Component**: The kind of query displayed by the dataframe view.""" - - LatestAt = 1 - """Query""" - - TimeRange = 2 - """Time range query.""" - - @classmethod - def auto(cls, val: str | int | QueryKind) -> QueryKind: - """Best-effort converter, including a case-insensitive string matcher.""" - if isinstance(val, QueryKind): - 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 - - -QueryKindLike = Union[QueryKind, Literal["LatestAt", "TimeRange", "latestat", "timerange"], int] -QueryKindArrayLike = Union[QueryKindLike, Sequence[QueryKindLike]] - - -class QueryKindType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.components.QueryKind" - - def __init__(self) -> None: - pa.ExtensionType.__init__(self, pa.uint8(), self._TYPE_NAME) - - -class QueryKindBatch(BaseBatch[QueryKindArrayLike], ComponentBatchMixin): - _ARROW_TYPE = QueryKindType() - - @staticmethod - def _native_to_pa_array(data: QueryKindArrayLike, data_type: pa.DataType) -> pa.Array: - if isinstance(data, (QueryKind, int, str)): - data = [data] - - pa_data = [QueryKind.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/time_range_queries.py b/rerun_py/rerun_sdk/rerun/blueprint/components/time_range_queries.py deleted file mode 100644 index 9ce123e390cb..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/components/time_range_queries.py +++ /dev/null @@ -1,91 +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/time_range_queries.fbs". - -# You can extend this class by creating a "TimeRangeQueriesExt" class in "time_range_queries_ext.py". - -from __future__ import annotations - -from typing import Any, Sequence, Union - -import pyarrow as pa -from attrs import define, field - -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, - ComponentBatchMixin, - ComponentMixin, -) -from ...blueprint import datatypes as blueprint_datatypes - -__all__ = [ - "TimeRangeQueries", - "TimeRangeQueriesArrayLike", - "TimeRangeQueriesBatch", - "TimeRangeQueriesLike", - "TimeRangeQueriesType", -] - - -@define(init=False) -class TimeRangeQueries(ComponentMixin): - """ - **Component**: Configuration for time range queries. - - Note: configuration as saved on a per-timeline basis. - """ - - _BATCH_TYPE = None - - def __init__(self: Any, queries: TimeRangeQueriesLike): - """Create a new instance of the TimeRangeQueries component.""" - - # You can define your own __init__ function as a member of TimeRangeQueriesExt in time_range_queries_ext.py - self.__attrs_init__(queries=queries) - - queries: list[blueprint_datatypes.TimeRangeQuery] = field() - - -TimeRangeQueriesLike = TimeRangeQueries -TimeRangeQueriesArrayLike = Union[ - TimeRangeQueries, - Sequence[TimeRangeQueriesLike], -] - - -class TimeRangeQueriesType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.components.TimeRangeQueries" - - def __init__(self) -> None: - pa.ExtensionType.__init__( - self, - pa.list_( - pa.field( - "item", - pa.struct([ - pa.field("timeline", pa.utf8(), nullable=False, metadata={}), - pa.field("pov_entity", pa.utf8(), nullable=False, metadata={}), - pa.field("pov_component", pa.utf8(), nullable=False, metadata={}), - pa.field("start", pa.int64(), nullable=False, metadata={}), - pa.field("end", pa.int64(), nullable=False, metadata={}), - ]), - nullable=False, - metadata={}, - ) - ), - self._TYPE_NAME, - ) - - -class TimeRangeQueriesBatch(BaseBatch[TimeRangeQueriesArrayLike], ComponentBatchMixin): - _ARROW_TYPE = TimeRangeQueriesType() - - @staticmethod - def _native_to_pa_array(data: TimeRangeQueriesArrayLike, data_type: pa.DataType) -> pa.Array: - raise NotImplementedError( - "Arrow serialization of TimeRangeQueries not implemented: We lack codegen for arrow-serialization of general structs" - ) # You need to implement native_to_pa_array_override in time_range_queries_ext.py - - -# This is patched in late to avoid circular dependencies. -TimeRangeQueries._BATCH_TYPE = TimeRangeQueriesBatch # type: ignore[assignment] diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes index e85f1bd4abca..734652dcd8b3 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/.gitattributes @@ -5,8 +5,6 @@ __init__.py linguist-generated=true component_column_selector.py linguist-generated=true filter_by_event.py linguist-generated=true filter_by_range.py linguist-generated=true -latest_at_query.py linguist-generated=true selected_columns.py linguist-generated=true tensor_dimension_index_slider.py linguist-generated=true -time_range_query.py linguist-generated=true utf8list.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py index 9c2c2298e586..679566573dd3 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/__init__.py @@ -23,13 +23,6 @@ FilterByRangeLike, FilterByRangeType, ) -from .latest_at_query import ( - LatestAtQuery, - LatestAtQueryArrayLike, - LatestAtQueryBatch, - LatestAtQueryLike, - LatestAtQueryType, -) from .selected_columns import ( SelectedColumns, SelectedColumnsArrayLike, @@ -44,13 +37,6 @@ TensorDimensionIndexSliderLike, TensorDimensionIndexSliderType, ) -from .time_range_query import ( - TimeRangeQuery, - TimeRangeQueryArrayLike, - TimeRangeQueryBatch, - TimeRangeQueryLike, - TimeRangeQueryType, -) from .utf8list import Utf8List, Utf8ListArrayLike, Utf8ListBatch, Utf8ListLike, Utf8ListType __all__ = [ @@ -69,11 +55,6 @@ "FilterByRangeBatch", "FilterByRangeLike", "FilterByRangeType", - "LatestAtQuery", - "LatestAtQueryArrayLike", - "LatestAtQueryBatch", - "LatestAtQueryLike", - "LatestAtQueryType", "SelectedColumns", "SelectedColumnsArrayLike", "SelectedColumnsBatch", @@ -84,11 +65,6 @@ "TensorDimensionIndexSliderBatch", "TensorDimensionIndexSliderLike", "TensorDimensionIndexSliderType", - "TimeRangeQuery", - "TimeRangeQueryArrayLike", - "TimeRangeQueryBatch", - "TimeRangeQueryLike", - "TimeRangeQueryType", "Utf8List", "Utf8ListArrayLike", "Utf8ListBatch", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query.py deleted file mode 100644 index 793a092469ca..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query.py +++ /dev/null @@ -1,100 +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/datatypes/latest_at_query.fbs". - -# You can extend this class by creating a "LatestAtQueryExt" class in "latest_at_query_ext.py". - -from __future__ import annotations - -from typing import Any, Sequence, Union - -import pyarrow as pa -from attrs import define, field - -from ... import datatypes -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, -) -from .latest_at_query_ext import LatestAtQueryExt - -__all__ = ["LatestAtQuery", "LatestAtQueryArrayLike", "LatestAtQueryBatch", "LatestAtQueryLike", "LatestAtQueryType"] - - -def _latest_at_query__timeline__special_field_converter_override(x: datatypes.Utf8Like) -> datatypes.Utf8: - if isinstance(x, datatypes.Utf8): - return x - else: - return datatypes.Utf8(x) - - -@define(init=False) -class LatestAtQuery(LatestAtQueryExt): - """**Datatype**: Latest-at query configuration for a specific timeline.""" - - def __init__(self: Any, timeline: datatypes.Utf8Like, time: datatypes.TimeIntLike): - """ - Create a new instance of the LatestAtQuery datatype. - - Parameters - ---------- - timeline: - Name of the timeline this applies to. - time: - Time value to use for this query. - - """ - - # You can define your own __init__ function as a member of LatestAtQueryExt in latest_at_query_ext.py - self.__attrs_init__(timeline=timeline, time=time) - - timeline: datatypes.Utf8 = field(converter=_latest_at_query__timeline__special_field_converter_override) - # Name of the timeline this applies to. - # - # (Docstring intentionally commented out to hide this field from the docs) - - time: datatypes.TimeInt = field( - converter=LatestAtQueryExt.time__field_converter_override, # type: ignore[misc] - ) - # Time value to use for this query. - # - # (Docstring intentionally commented out to hide this field from the docs) - - -LatestAtQueryLike = LatestAtQuery -LatestAtQueryArrayLike = Union[ - LatestAtQuery, - Sequence[LatestAtQueryLike], -] - - -class LatestAtQueryType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.datatypes.LatestAtQuery" - - def __init__(self) -> None: - pa.ExtensionType.__init__( - self, - pa.struct([ - pa.field("timeline", pa.utf8(), nullable=False, metadata={}), - pa.field("time", pa.int64(), nullable=False, metadata={}), - ]), - self._TYPE_NAME, - ) - - -class LatestAtQueryBatch(BaseBatch[LatestAtQueryArrayLike]): - _ARROW_TYPE = LatestAtQueryType() - - @staticmethod - def _native_to_pa_array(data: LatestAtQueryArrayLike, data_type: pa.DataType) -> pa.Array: - from rerun.datatypes import TimeIntBatch, Utf8Batch - - if isinstance(data, LatestAtQuery): - data = [data] - - return pa.StructArray.from_arrays( - [ - Utf8Batch([x.timeline for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - TimeIntBatch([x.time for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - ], - fields=list(data_type), - ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query_ext.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query_ext.py deleted file mode 100644 index 92805bd119e8..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/latest_at_query_ext.py +++ /dev/null @@ -1,17 +0,0 @@ -from __future__ import annotations - -from ... import datatypes - - -class LatestAtQueryExt: - """Extension for [LatestAtQuery][rerun.blueprint.datatypes.LatestAtQuery].""" - - # This override is required because otherwise the codegen uses `TimeInt(x)`, which is not valid with the custom - # `TimeInt.__init__` override. - - @staticmethod - def time__field_converter_override(x: datatypes.TimeIntLike) -> datatypes.TimeInt: - if isinstance(x, datatypes.TimeInt): - return x - else: - return datatypes.TimeInt(seq=x) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query.py deleted file mode 100644 index 15becf69f775..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query.py +++ /dev/null @@ -1,170 +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/datatypes/time_range_query.fbs". - -# You can extend this class by creating a "TimeRangeQueryExt" class in "time_range_query_ext.py". - -from __future__ import annotations - -from typing import Any, Sequence, Union - -import pyarrow as pa -from attrs import define, field - -from ... import datatypes -from ..._baseclasses import ( - BaseBatch, - BaseExtensionType, -) -from .time_range_query_ext import TimeRangeQueryExt - -__all__ = [ - "TimeRangeQuery", - "TimeRangeQueryArrayLike", - "TimeRangeQueryBatch", - "TimeRangeQueryLike", - "TimeRangeQueryType", -] - - -def _time_range_query__timeline__special_field_converter_override(x: datatypes.Utf8Like) -> datatypes.Utf8: - if isinstance(x, datatypes.Utf8): - return x - else: - return datatypes.Utf8(x) - - -def _time_range_query__pov_entity__special_field_converter_override( - x: datatypes.EntityPathLike, -) -> datatypes.EntityPath: - if isinstance(x, datatypes.EntityPath): - return x - else: - return datatypes.EntityPath(x) - - -def _time_range_query__pov_component__special_field_converter_override(x: datatypes.Utf8Like) -> datatypes.Utf8: - if isinstance(x, datatypes.Utf8): - return x - else: - return datatypes.Utf8(x) - - -@define(init=False) -class TimeRangeQuery(TimeRangeQueryExt): - """**Datatype**: Time range query configuration for a specific timeline.""" - - def __init__( - self: Any, - timeline: datatypes.Utf8Like, - pov_entity: datatypes.EntityPathLike, - pov_component: datatypes.Utf8Like, - start: datatypes.TimeIntLike, - end: datatypes.TimeIntLike, - ): - """ - Create a new instance of the TimeRangeQuery datatype. - - Parameters - ---------- - timeline: - Name of the timeline this applies to. - pov_entity: - Point-of-view entity. - - Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - in the results returned by the range query. - pov_component: - Point-of-view component. - - Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - in the results returned by the range query. - start: - Beginning of the time range. - end: - End of the time range (inclusive). - - """ - - # You can define your own __init__ function as a member of TimeRangeQueryExt in time_range_query_ext.py - self.__attrs_init__(timeline=timeline, pov_entity=pov_entity, pov_component=pov_component, start=start, end=end) - - timeline: datatypes.Utf8 = field(converter=_time_range_query__timeline__special_field_converter_override) - # Name of the timeline this applies to. - # - # (Docstring intentionally commented out to hide this field from the docs) - - pov_entity: datatypes.EntityPath = field(converter=_time_range_query__pov_entity__special_field_converter_override) - # Point-of-view entity. - # - # Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - # in the results returned by the range query. - # - # (Docstring intentionally commented out to hide this field from the docs) - - pov_component: datatypes.Utf8 = field(converter=_time_range_query__pov_component__special_field_converter_override) - # Point-of-view component. - # - # Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row - # in the results returned by the range query. - # - # (Docstring intentionally commented out to hide this field from the docs) - - start: datatypes.TimeInt = field( - converter=TimeRangeQueryExt.start__field_converter_override, # type: ignore[misc] - ) - # Beginning of the time range. - # - # (Docstring intentionally commented out to hide this field from the docs) - - end: datatypes.TimeInt = field( - converter=TimeRangeQueryExt.end__field_converter_override, # type: ignore[misc] - ) - # End of the time range (inclusive). - # - # (Docstring intentionally commented out to hide this field from the docs) - - -TimeRangeQueryLike = TimeRangeQuery -TimeRangeQueryArrayLike = Union[ - TimeRangeQuery, - Sequence[TimeRangeQueryLike], -] - - -class TimeRangeQueryType(BaseExtensionType): - _TYPE_NAME: str = "rerun.blueprint.datatypes.TimeRangeQuery" - - def __init__(self) -> None: - pa.ExtensionType.__init__( - self, - pa.struct([ - pa.field("timeline", pa.utf8(), nullable=False, metadata={}), - pa.field("pov_entity", pa.utf8(), nullable=False, metadata={}), - pa.field("pov_component", pa.utf8(), nullable=False, metadata={}), - pa.field("start", pa.int64(), nullable=False, metadata={}), - pa.field("end", pa.int64(), nullable=False, metadata={}), - ]), - self._TYPE_NAME, - ) - - -class TimeRangeQueryBatch(BaseBatch[TimeRangeQueryArrayLike]): - _ARROW_TYPE = TimeRangeQueryType() - - @staticmethod - def _native_to_pa_array(data: TimeRangeQueryArrayLike, data_type: pa.DataType) -> pa.Array: - from rerun.datatypes import EntityPathBatch, TimeIntBatch, Utf8Batch - - if isinstance(data, TimeRangeQuery): - data = [data] - - return pa.StructArray.from_arrays( - [ - Utf8Batch([x.timeline for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - EntityPathBatch([x.pov_entity for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - Utf8Batch([x.pov_component for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - TimeIntBatch([x.start for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - TimeIntBatch([x.end for x in data]).as_arrow_array().storage, # type: ignore[misc, arg-type] - ], - fields=list(data_type), - ) diff --git a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query_ext.py b/rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query_ext.py deleted file mode 100644 index 6ddc984eb361..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/datatypes/time_range_query_ext.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import annotations - -from ... import datatypes - - -class TimeRangeQueryExt: - """Extension for [TimeRangeQuery][rerun.blueprint.datatypes.TimeRangeQuery].""" - - # These overrides are required because otherwise the codegen uses `TimeInt(x)`, which is not valid with the custom - # `TimeInt.__init__` override. - - @staticmethod - def start__field_converter_override(x: datatypes.TimeIntLike) -> datatypes.TimeInt: - if isinstance(x, datatypes.TimeInt): - return x - else: - return datatypes.TimeInt(seq=x) - - @staticmethod - def end__field_converter_override(x: datatypes.TimeIntLike) -> datatypes.TimeInt: - if isinstance(x, datatypes.TimeInt): - return x - else: - return datatypes.TimeInt(seq=x) From b693de3fe879366bd2091c157a6c666db03c783a Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Wed, 2 Oct 2024 19:25:45 +0200 Subject: [PATCH 2/5] Rename `DataframeQueryV2` -> `DataframeQuery` --- .../blueprint/archetypes/dataframe_query.fbs | 2 +- .../rerun/blueprint/views/dataframe.fbs | 2 +- .../src/blueprint/archetypes/.gitattributes | 2 +- ...taframe_query_v2.rs => dataframe_query.rs} | 42 +++++++++---------- .../re_types/src/blueprint/archetypes/mod.rs | 4 +- .../src/blueprint/views/dataframe_view.rs | 16 +++---- .../src/view_query_v2/mod.rs | 4 +- crates/viewer/re_viewer/src/reflection/mod.rs | 4 +- docs/snippets/all/views/dataframe.py | 2 +- rerun_cpp/src/rerun/blueprint/archetypes.hpp | 2 +- .../rerun/blueprint/archetypes/.gitattributes | 4 +- ...frame_query_v2.cpp => dataframe_query.cpp} | 8 ++-- ...frame_query_v2.hpp => dataframe_query.hpp} | 22 +++++----- .../rerun/blueprint/archetypes/.gitattributes | 2 +- .../rerun/blueprint/archetypes/__init__.py | 4 +- ...taframe_query_v2.py => dataframe_query.py} | 14 +++---- ...query_v2_ext.py => dataframe_query_ext.py} | 6 +-- .../rerun/blueprint/views/dataframe_view.py | 10 ++--- .../tests/unit/test_dataframe_view_query.py | 6 +-- 19 files changed, 78 insertions(+), 78 deletions(-) rename crates/store/re_types/src/blueprint/archetypes/{dataframe_query_v2.rs => dataframe_query.rs} (91%) rename rerun_cpp/src/rerun/blueprint/archetypes/{dataframe_query_v2.cpp => dataframe_query.cpp} (88%) rename rerun_cpp/src/rerun/blueprint/archetypes/{dataframe_query_v2.hpp => dataframe_query.hpp} (86%) rename rerun_py/rerun_sdk/rerun/blueprint/archetypes/{dataframe_query_v2.py => dataframe_query.py} (88%) rename rerun_py/rerun_sdk/rerun/blueprint/archetypes/{dataframe_query_v2_ext.py => dataframe_query_ext.py} (92%) diff --git a/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs b/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs index bb3f8b55e867..60d35e40ad9d 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/archetypes/dataframe_query.fbs @@ -2,7 +2,7 @@ namespace rerun.blueprint.archetypes; /// The query for the dataframe view. -table DataframeQueryV2 ( +table DataframeQuery ( "attr.rerun.scope": "blueprint" ) { // --- Optional --- diff --git a/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs index 94fe9c936273..2339372d1f92 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs @@ -10,5 +10,5 @@ table DataframeView ( "attr.rerun.view_identifier": "Dataframe" ) { /// Query of the dataframe. - query: rerun.blueprint.archetypes.DataframeQueryV2 (order: 1000); + query: rerun.blueprint.archetypes.DataframeQuery (order: 1000); } diff --git a/crates/store/re_types/src/blueprint/archetypes/.gitattributes b/crates/store/re_types/src/blueprint/archetypes/.gitattributes index edde431a5d88..8275cbf12a81 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -2,7 +2,7 @@ .gitattributes linguist-generated=true background.rs linguist-generated=true -dataframe_query_v2.rs linguist-generated=true +dataframe_query.rs linguist-generated=true mod.rs linguist-generated=true plot_legend.rs linguist-generated=true scalar_axis.rs linguist-generated=true diff --git a/crates/store/re_types/src/blueprint/archetypes/dataframe_query_v2.rs b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs similarity index 91% rename from crates/store/re_types/src/blueprint/archetypes/dataframe_query_v2.rs rename to crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs index 754e4e3f161e..7c3d77476cbd 100644 --- a/crates/store/re_types/src/blueprint/archetypes/dataframe_query_v2.rs +++ b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs @@ -20,7 +20,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; /// **Archetype**: The query for the dataframe view. #[derive(Clone, Debug)] -pub struct DataframeQueryV2 { +pub struct DataframeQuery { /// The timeline for this query. /// /// If unset, the timeline currently active on the time panel is used. @@ -41,7 +41,7 @@ pub struct DataframeQueryV2 { pub select: Option, } -impl ::re_types_core::SizeBytes for DataframeQueryV2 { +impl ::re_types_core::SizeBytes for DataframeQuery { #[inline] fn heap_size_bytes(&self) -> u64 { self.timeline.heap_size_bytes() @@ -65,7 +65,7 @@ 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.DataframeQueryV2Indicator".into()]); + once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.DataframeQueryIndicator".into()]); static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = once_cell::sync::Lazy::new(|| { @@ -81,7 +81,7 @@ static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = once_cell::sync::Lazy::new(|| { [ - "rerun.blueprint.components.DataframeQueryV2Indicator".into(), + "rerun.blueprint.components.DataframeQueryIndicator".into(), "rerun.blueprint.components.TimelineName".into(), "rerun.blueprint.components.FilterByRange".into(), "rerun.blueprint.components.FilterByEvent".into(), @@ -90,30 +90,30 @@ static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = ] }); -impl DataframeQueryV2 { +impl DataframeQuery { /// The total number of components in the archetype: 0 required, 1 recommended, 5 optional pub const NUM_COMPONENTS: usize = 6usize; } -/// Indicator component for the [`DataframeQueryV2`] [`::re_types_core::Archetype`] -pub type DataframeQueryV2Indicator = ::re_types_core::GenericIndicatorComponent; +/// Indicator component for the [`DataframeQuery`] [`::re_types_core::Archetype`] +pub type DataframeQueryIndicator = ::re_types_core::GenericIndicatorComponent; -impl ::re_types_core::Archetype for DataframeQueryV2 { - type Indicator = DataframeQueryV2Indicator; +impl ::re_types_core::Archetype for DataframeQuery { + type Indicator = DataframeQueryIndicator; #[inline] fn name() -> ::re_types_core::ArchetypeName { - "rerun.blueprint.archetypes.DataframeQueryV2".into() + "rerun.blueprint.archetypes.DataframeQuery".into() } #[inline] fn display_name() -> &'static str { - "Dataframe query v2" + "Dataframe query" } #[inline] fn indicator() -> MaybeOwnedComponentBatch<'static> { - static INDICATOR: DataframeQueryV2Indicator = DataframeQueryV2Indicator::DEFAULT; + static INDICATOR: DataframeQueryIndicator = DataframeQueryIndicator::DEFAULT; MaybeOwnedComponentBatch::Ref(&INDICATOR) } @@ -150,7 +150,7 @@ impl ::re_types_core::Archetype for DataframeQueryV2 { let timeline = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.TimelineName") { ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQueryV2#timeline")? + .with_context("rerun.blueprint.archetypes.DataframeQuery#timeline")? .into_iter() .next() .flatten() @@ -160,7 +160,7 @@ impl ::re_types_core::Archetype for DataframeQueryV2 { let filter_by_range = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.FilterByRange") { ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQueryV2#filter_by_range")? + .with_context("rerun.blueprint.archetypes.DataframeQuery#filter_by_range")? .into_iter() .next() .flatten() @@ -170,7 +170,7 @@ impl ::re_types_core::Archetype for DataframeQueryV2 { let filter_by_event = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.FilterByEvent") { ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQueryV2#filter_by_event")? + .with_context("rerun.blueprint.archetypes.DataframeQuery#filter_by_event")? .into_iter() .next() .flatten() @@ -180,7 +180,7 @@ impl ::re_types_core::Archetype for DataframeQueryV2 { let apply_latest_at = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.ApplyLatestAt") { ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQueryV2#apply_latest_at")? + .with_context("rerun.blueprint.archetypes.DataframeQuery#apply_latest_at")? .into_iter() .next() .flatten() @@ -190,7 +190,7 @@ impl ::re_types_core::Archetype for DataframeQueryV2 { let select = if let Some(array) = arrays_by_name.get("rerun.blueprint.components.SelectedColumns") { ::from_arrow_opt(&**array) - .with_context("rerun.blueprint.archetypes.DataframeQueryV2#select")? + .with_context("rerun.blueprint.archetypes.DataframeQuery#select")? .into_iter() .next() .flatten() @@ -207,7 +207,7 @@ impl ::re_types_core::Archetype for DataframeQueryV2 { } } -impl ::re_types_core::AsComponents for DataframeQueryV2 { +impl ::re_types_core::AsComponents for DataframeQuery { fn as_component_batches(&self) -> Vec> { re_tracing::profile_function!(); use ::re_types_core::Archetype as _; @@ -235,10 +235,10 @@ impl ::re_types_core::AsComponents for DataframeQueryV2 { } } -impl ::re_types_core::ArchetypeReflectionMarker for DataframeQueryV2 {} +impl ::re_types_core::ArchetypeReflectionMarker for DataframeQuery {} -impl DataframeQueryV2 { - /// Create a new `DataframeQueryV2`. +impl DataframeQuery { + /// Create a new `DataframeQuery`. #[inline] pub fn new() -> Self { Self { diff --git a/crates/store/re_types/src/blueprint/archetypes/mod.rs b/crates/store/re_types/src/blueprint/archetypes/mod.rs index 250c53af0a1a..19f7dfedff0c 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -1,7 +1,7 @@ // DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs mod background; -mod dataframe_query_v2; +mod dataframe_query; mod plot_legend; mod scalar_axis; mod space_view_blueprint; @@ -14,7 +14,7 @@ mod visible_time_ranges_ext; mod visual_bounds2d; pub use self::background::Background; -pub use self::dataframe_query_v2::DataframeQueryV2; +pub use self::dataframe_query::DataframeQuery; pub use self::plot_legend::PlotLegend; pub use self::scalar_axis::ScalarAxis; pub use self::space_view_blueprint::SpaceViewBlueprint; diff --git a/crates/store/re_types/src/blueprint/views/dataframe_view.rs b/crates/store/re_types/src/blueprint/views/dataframe_view.rs index 1f5eb956b490..bcf2398d2efd 100644 --- a/crates/store/re_types/src/blueprint/views/dataframe_view.rs +++ b/crates/store/re_types/src/blueprint/views/dataframe_view.rs @@ -24,7 +24,7 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; #[derive(Clone, Debug)] pub struct DataframeView { /// Query of the dataframe. - pub query: crate::blueprint::archetypes::DataframeQueryV2, + pub query: crate::blueprint::archetypes::DataframeQuery, } impl ::re_types_core::SizeBytes for DataframeView { @@ -35,35 +35,35 @@ impl ::re_types_core::SizeBytes for DataframeView { #[inline] fn is_pod() -> bool { - ::is_pod() + ::is_pod() } } -impl> From for DataframeView { +impl> From for DataframeView { fn from(v: T) -> Self { Self { query: v.into() } } } -impl std::borrow::Borrow for DataframeView { +impl std::borrow::Borrow for DataframeView { #[inline] - fn borrow(&self) -> &crate::blueprint::archetypes::DataframeQueryV2 { + fn borrow(&self) -> &crate::blueprint::archetypes::DataframeQuery { &self.query } } impl std::ops::Deref for DataframeView { - type Target = crate::blueprint::archetypes::DataframeQueryV2; + type Target = crate::blueprint::archetypes::DataframeQuery; #[inline] - fn deref(&self) -> &crate::blueprint::archetypes::DataframeQueryV2 { + fn deref(&self) -> &crate::blueprint::archetypes::DataframeQuery { &self.query } } impl std::ops::DerefMut for DataframeView { #[inline] - fn deref_mut(&mut self) -> &mut crate::blueprint::archetypes::DataframeQueryV2 { + fn deref_mut(&mut self) -> &mut crate::blueprint::archetypes::DataframeQuery { &mut self.query } } diff --git a/crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs b/crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs index 7c505bf345ab..70901619d384 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs +++ b/crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs @@ -6,7 +6,7 @@ use re_types::blueprint::archetypes; use re_viewer_context::{SpaceViewId, SpaceViewSystemExecutionError, ViewerContext}; use re_viewport_blueprint::ViewProperty; -/// Wrapper over the `DataframeQueryV2` blueprint archetype that can also display some UI. +/// Wrapper over the `DataframeQuery` blueprint archetype that can also display some UI. pub(crate) struct QueryV2 { query_property: ViewProperty, } @@ -17,7 +17,7 @@ impl QueryV2 { /// See the `blueprint_io` module for more related accessors. pub(crate) fn from_blueprint(ctx: &ViewerContext<'_>, space_view_id: SpaceViewId) -> Self { Self { - query_property: ViewProperty::from_archetype::( + query_property: ViewProperty::from_archetype::( ctx.blueprint_db(), ctx.blueprint_query, space_view_id, diff --git a/crates/viewer/re_viewer/src/reflection/mod.rs b/crates/viewer/re_viewer/src/reflection/mod.rs index fb239a4d987e..92e4eb2f0358 100644 --- a/crates/viewer/re_viewer/src/reflection/mod.rs +++ b/crates/viewer/re_viewer/src/reflection/mod.rs @@ -1558,9 +1558,9 @@ fn generate_archetype_reflection() -> ArchetypeReflectionMap { }, ), ( - ArchetypeName::new("rerun.blueprint.archetypes.DataframeQueryV2"), + ArchetypeName::new("rerun.blueprint.archetypes.DataframeQuery"), ArchetypeReflection { - display_name: "Dataframe query v2", + display_name: "Dataframe query", fields: vec![ ArchetypeFieldReflection { component_name : "rerun.blueprint.components.TimelineName".into(), display_name : diff --git a/docs/snippets/all/views/dataframe.py b/docs/snippets/all/views/dataframe.py index 569835fa4581..6260650f6721 100644 --- a/docs/snippets/all/views/dataframe.py +++ b/docs/snippets/all/views/dataframe.py @@ -21,7 +21,7 @@ blueprint = rrb.Blueprint( rrb.DataframeView( origin="/trig", - query=rrb.archetypes.DataframeQueryV2( + query=rrb.archetypes.DataframeQuery( timeline="t", filter_by_range=(rr.TimeInt(seconds=0), rr.TimeInt(seconds=20)), filter_by_event="/trig/tan_sparse:Scalar", diff --git a/rerun_cpp/src/rerun/blueprint/archetypes.hpp b/rerun_cpp/src/rerun/blueprint/archetypes.hpp index 06112024611b..eae71f6b2164 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -4,7 +4,7 @@ #include "blueprint/archetypes/background.hpp" #include "blueprint/archetypes/container_blueprint.hpp" -#include "blueprint/archetypes/dataframe_query_v2.hpp" +#include "blueprint/archetypes/dataframe_query.hpp" #include "blueprint/archetypes/panel_blueprint.hpp" #include "blueprint/archetypes/plot_legend.hpp" #include "blueprint/archetypes/scalar_axis.hpp" diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes index f35709bd8af0..40240eeaa29b 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -5,8 +5,8 @@ background.cpp linguist-generated=true background.hpp linguist-generated=true container_blueprint.cpp linguist-generated=true container_blueprint.hpp linguist-generated=true -dataframe_query_v2.cpp linguist-generated=true -dataframe_query_v2.hpp linguist-generated=true +dataframe_query.cpp linguist-generated=true +dataframe_query.hpp linguist-generated=true panel_blueprint.cpp linguist-generated=true panel_blueprint.hpp linguist-generated=true plot_legend.cpp linguist-generated=true diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp similarity index 88% rename from rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp rename to rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp index 975951588686..aee5527b2269 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp @@ -1,7 +1,7 @@ // 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/dataframe_query.fbs". -#include "dataframe_query_v2.hpp" +#include "dataframe_query.hpp" #include "../../collection_adapter_builtins.hpp" @@ -10,8 +10,8 @@ namespace rerun::blueprint::archetypes {} namespace rerun { Result> - AsComponents::serialize( - const blueprint::archetypes::DataframeQueryV2& archetype + AsComponents::serialize( + const blueprint::archetypes::DataframeQuery& archetype ) { using namespace blueprint::archetypes; std::vector cells; @@ -43,7 +43,7 @@ namespace rerun { cells.push_back(std::move(result.value)); } { - auto indicator = DataframeQueryV2::IndicatorComponent(); + auto indicator = DataframeQuery::IndicatorComponent(); auto result = ComponentBatch::from_loggable(indicator); RR_RETURN_NOT_OK(result.error); cells.emplace_back(std::move(result.value)); diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp similarity index 86% rename from rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.hpp rename to rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp index a208d87021c7..5ced1636767a 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp @@ -21,7 +21,7 @@ namespace rerun::blueprint::archetypes { /// **Archetype**: The query for the dataframe view. - struct DataframeQueryV2 { + struct DataframeQuery { /// The timeline for this query. /// /// If unset, the timeline currently active on the time panel is used. @@ -43,19 +43,19 @@ namespace rerun::blueprint::archetypes { public: static constexpr const char IndicatorComponentName[] = - "rerun.blueprint.components.DataframeQueryV2Indicator"; + "rerun.blueprint.components.DataframeQueryIndicator"; /// Indicator component, used to identify the archetype when converting to a list of components. using IndicatorComponent = rerun::components::IndicatorComponent; public: - DataframeQueryV2() = default; - DataframeQueryV2(DataframeQueryV2&& other) = default; + DataframeQuery() = default; + DataframeQuery(DataframeQuery&& other) = default; /// The timeline for this query. /// /// If unset, the timeline currently active on the time panel is used. - DataframeQueryV2 with_timeline(rerun::blueprint::components::TimelineName _timeline) && { + DataframeQuery with_timeline(rerun::blueprint::components::TimelineName _timeline) && { timeline = std::move(_timeline); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) @@ -64,7 +64,7 @@ namespace rerun::blueprint::archetypes { /// If provided, only rows whose timestamp is within this range will be shown. /// /// Note: will be unset as soon as `timeline` is changed. - DataframeQueryV2 with_filter_by_range( + DataframeQuery with_filter_by_range( rerun::blueprint::components::FilterByRange _filter_by_range ) && { filter_by_range = std::move(_filter_by_range); @@ -73,7 +73,7 @@ namespace rerun::blueprint::archetypes { } /// If provided, only show rows which contains a logged event for the specified component. - DataframeQueryV2 with_filter_by_event( + DataframeQuery with_filter_by_event( rerun::blueprint::components::FilterByEvent _filter_by_event ) && { filter_by_event = std::move(_filter_by_event); @@ -82,7 +82,7 @@ namespace rerun::blueprint::archetypes { } /// Should empty cells be filled with latest-at queries? - DataframeQueryV2 with_apply_latest_at( + DataframeQuery with_apply_latest_at( rerun::blueprint::components::ApplyLatestAt _apply_latest_at ) && { apply_latest_at = std::move(_apply_latest_at); @@ -91,7 +91,7 @@ namespace rerun::blueprint::archetypes { } /// Selected columns. If unset, all columns are selected. - DataframeQueryV2 with_select(rerun::blueprint::components::SelectedColumns _select) && { + DataframeQuery with_select(rerun::blueprint::components::SelectedColumns _select) && { select = std::move(_select); // See: https://github.com/rerun-io/rerun/issues/4027 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) @@ -107,10 +107,10 @@ namespace rerun { /// \private template <> - struct AsComponents { + struct AsComponents { /// Serialize all set component batches. static Result> serialize( - const blueprint::archetypes::DataframeQueryV2& archetype + const blueprint::archetypes::DataframeQuery& archetype ); }; } // namespace rerun diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes index 40fce6cf7f44..1db9a825f2e9 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -4,7 +4,7 @@ __init__.py linguist-generated=true background.py linguist-generated=true container_blueprint.py linguist-generated=true -dataframe_query_v2.py linguist-generated=true +dataframe_query.py linguist-generated=true panel_blueprint.py linguist-generated=true plot_legend.py linguist-generated=true scalar_axis.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 497b4e9dfe10..423f025dc7aa 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -4,7 +4,7 @@ from .background import Background from .container_blueprint import ContainerBlueprint -from .dataframe_query_v2 import DataframeQueryV2 +from .dataframe_query import DataframeQuery from .panel_blueprint import PanelBlueprint from .plot_legend import PlotLegend from .scalar_axis import ScalarAxis @@ -20,7 +20,7 @@ __all__ = [ "Background", "ContainerBlueprint", - "DataframeQueryV2", + "DataframeQuery", "PanelBlueprint", "PlotLegend", "ScalarAxis", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py similarity index 88% rename from rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.py rename to rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py index 9c7e702f1df4..e624479321ee 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py @@ -1,7 +1,7 @@ # 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/dataframe_query.fbs". -# You can extend this class by creating a "DataframeQueryV2Ext" class in "dataframe_query_v2_ext.py". +# You can extend this class by creating a "DataframeQueryExt" class in "dataframe_query_ext.py". from __future__ import annotations @@ -11,16 +11,16 @@ Archetype, ) from ...blueprint import components as blueprint_components -from .dataframe_query_v2_ext import DataframeQueryV2Ext +from .dataframe_query_ext import DataframeQueryExt -__all__ = ["DataframeQueryV2"] +__all__ = ["DataframeQuery"] @define(str=False, repr=False, init=False) -class DataframeQueryV2(DataframeQueryV2Ext, Archetype): +class DataframeQuery(DataframeQueryExt, Archetype): """**Archetype**: The query for the dataframe view.""" - # __init__ can be found in dataframe_query_v2_ext.py + # __init__ can be found in dataframe_query_ext.py def __attrs_clear__(self) -> None: """Convenience method for calling `__attrs_init__` with all `None`s.""" @@ -33,8 +33,8 @@ def __attrs_clear__(self) -> None: ) @classmethod - def _clear(cls) -> DataframeQueryV2: - """Produce an empty DataframeQueryV2, bypassing `__init__`.""" + def _clear(cls) -> DataframeQuery: + """Produce an empty DataframeQuery, bypassing `__init__`.""" inst = cls.__new__(cls) inst.__attrs_clear__() return inst diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2_ext.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_ext.py similarity index 92% rename from rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2_ext.py rename to rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_ext.py index 61aa75593b20..d6a0bbf2a814 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2_ext.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_ext.py @@ -7,8 +7,8 @@ from ...error_utils import catch_and_log_exceptions -class DataframeQueryV2Ext: - """Extension for [DataframeQueryV2][rerun.blueprint.archetypes.DataframeQueryV2].""" +class DataframeQueryExt: + """Extension for [DataframeQuery][rerun.blueprint.archetypes.DataframeQuery].""" def __init__( self: Any, @@ -22,7 +22,7 @@ def __init__( select: list[blueprint_datatypes.ComponentColumnSelectorLike | datatypes.Utf8Like | str] | None = None, ): """ - Create a new instance of the DataframeQueryV2 archetype. + Create a new instance of the DataframeQuery archetype. Parameters ---------- diff --git a/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py b/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py index 1ae8d946cd8f..98f77badafb0 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/views/dataframe_view.py @@ -46,7 +46,7 @@ class DataframeView(SpaceView): blueprint = rrb.Blueprint( rrb.DataframeView( origin="/trig", - query=rrb.archetypes.DataframeQueryV2( + query=rrb.archetypes.DataframeQuery( timeline="t", filter_by_range=(rr.TimeInt(seconds=0), rr.TimeInt(seconds=20)), filter_by_event="/trig/tan_sparse:Scalar", @@ -69,7 +69,7 @@ def __init__( visible: datatypes.BoolLike | None = None, defaults: list[Union[AsComponents, ComponentBatchLike]] = [], overrides: dict[EntityPathLike, list[ComponentBatchLike]] = {}, - query: blueprint_archetypes.DataframeQueryV2 | None = None, + query: blueprint_archetypes.DataframeQuery | None = None, ) -> None: """ Construct a blueprint for a new DataframeView view. @@ -107,9 +107,9 @@ def __init__( properties: dict[str, AsComponents] = {} if query is not None: - if not isinstance(query, blueprint_archetypes.DataframeQueryV2): - query = blueprint_archetypes.DataframeQueryV2(query) - properties["DataframeQueryV2"] = query + if not isinstance(query, blueprint_archetypes.DataframeQuery): + query = blueprint_archetypes.DataframeQuery(query) + properties["DataframeQuery"] = query super().__init__( class_identifier="Dataframe", diff --git a/rerun_py/tests/unit/test_dataframe_view_query.py b/rerun_py/tests/unit/test_dataframe_view_query.py index cd4dcbfd071f..332152c02d50 100644 --- a/rerun_py/tests/unit/test_dataframe_view_query.py +++ b/rerun_py/tests/unit/test_dataframe_view_query.py @@ -4,7 +4,7 @@ import rerun as rr import rerun.blueprint.components as blueprint_components from rerun import TimeInt, datatypes -from rerun.blueprint.archetypes import DataframeQueryV2 +from rerun.blueprint.archetypes import DataframeQuery def test_component_column_selector_explicit() -> None: @@ -123,7 +123,7 @@ def test_selected_columns_batch_multiple() -> None: def test_dataframe_query_property() -> None: - query = DataframeQueryV2( + query = DataframeQuery( timeline="frame", filter_by_range=(TimeInt(seq=1), TimeInt(seq=10)), filter_by_event="/entity/path:ComponentName", @@ -156,7 +156,7 @@ def test_dataframe_query_property() -> None: def test_dataframe_query_property_explicit() -> None: - query = DataframeQueryV2( + query = DataframeQuery( timeline=blueprint_components.TimelineName("frame"), filter_by_range=blueprint_components.FilterByRange(start=TimeInt(seq=1), end=TimeInt(seq=10)), filter_by_event=blueprint_components.ComponentColumnSelector( From 51d5cabdb1d7630e19305362c81bdb2d4dd967ab Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Wed, 2 Oct 2024 19:29:31 +0200 Subject: [PATCH 3/5] Renames in dataframe view code --- crates/viewer/re_space_view_dataframe/src/lib.rs | 2 +- .../viewer/re_space_view_dataframe/src/space_view_class.rs | 6 +++--- .../src/{view_query_v2 => view_query}/blueprint.rs | 4 ++-- .../src/{view_query_v2 => view_query}/mod.rs | 4 ++-- .../src/{view_query_v2 => view_query}/ui.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) rename crates/viewer/re_space_view_dataframe/src/{view_query_v2 => view_query}/blueprint.rs (99%) rename crates/viewer/re_space_view_dataframe/src/{view_query_v2 => view_query}/mod.rs (97%) rename crates/viewer/re_space_view_dataframe/src/{view_query_v2 => view_query}/ui.rs (99%) diff --git a/crates/viewer/re_space_view_dataframe/src/lib.rs b/crates/viewer/re_space_view_dataframe/src/lib.rs index dddb1dfc0de7..d3728e6defea 100644 --- a/crates/viewer/re_space_view_dataframe/src/lib.rs +++ b/crates/viewer/re_space_view_dataframe/src/lib.rs @@ -6,7 +6,7 @@ mod dataframe_ui; mod display_record_batch; mod expanded_rows; mod space_view_class; -mod view_query_v2; +mod view_query; mod visualizer_system; pub use space_view_class::DataframeSpaceView; 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 71a95618df49..93152b59107b 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,7 +1,7 @@ use std::any::Any; use crate::{ - dataframe_ui::dataframe_ui, expanded_rows::ExpandedRowsCache, view_query_v2, + dataframe_ui::dataframe_ui, expanded_rows::ExpandedRowsCache, view_query, visualizer_system::EmptySystem, }; use re_chunk_store::{ColumnDescriptor, ComponentColumnSelector, SparseFillStrategy}; @@ -105,7 +105,7 @@ mode sets the default time range to _everything_. You can override this in the s space_view_id: SpaceViewId, ) -> Result<(), SpaceViewSystemExecutionError> { let state = state.downcast_mut::()?; - let view_query = view_query_v2::QueryV2::from_blueprint(ctx, space_view_id); + let view_query = view_query::Query::from_blueprint(ctx, space_view_id); let Some(schema) = &state.schema else { // Shouldn't happen, except maybe on the first frame, which is too early // for the user to click the menu anyway. @@ -125,7 +125,7 @@ mode sets the default time range to _everything_. You can override this in the s re_tracing::profile_function!(); let state = state.downcast_mut::()?; - let view_query = view_query_v2::QueryV2::from_blueprint(ctx, query.space_view_id); + let view_query = view_query::Query::from_blueprint(ctx, query.space_view_id); let query_engine = re_dataframe2::QueryEngine { store: ctx.recording().store(), diff --git a/crates/viewer/re_space_view_dataframe/src/view_query_v2/blueprint.rs b/crates/viewer/re_space_view_dataframe/src/view_query/blueprint.rs similarity index 99% rename from crates/viewer/re_space_view_dataframe/src/view_query_v2/blueprint.rs rename to crates/viewer/re_space_view_dataframe/src/view_query/blueprint.rs index 7c96f52a7ba6..b9345756c4c3 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query_v2/blueprint.rs +++ b/crates/viewer/re_space_view_dataframe/src/view_query/blueprint.rs @@ -1,14 +1,14 @@ use std::collections::HashSet; use crate::dataframe_ui::HideColumnAction; -use crate::view_query_v2::QueryV2; +use crate::view_query::Query; use re_chunk_store::{ColumnDescriptor, ColumnSelector}; use re_log_types::{EntityPath, ResolvedTimeRange, TimelineName}; use re_types::blueprint::{components, datatypes}; use re_viewer_context::{SpaceViewSystemExecutionError, ViewerContext}; // Accessors wrapping reads/writes to the blueprint store. -impl QueryV2 { +impl Query { /// Get the query timeline. /// /// This tries to read the timeline name from the blueprint. If missing or invalid, the current diff --git a/crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs b/crates/viewer/re_space_view_dataframe/src/view_query/mod.rs similarity index 97% rename from crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs rename to crates/viewer/re_space_view_dataframe/src/view_query/mod.rs index 70901619d384..562407a14971 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query_v2/mod.rs +++ b/crates/viewer/re_space_view_dataframe/src/view_query/mod.rs @@ -7,11 +7,11 @@ use re_viewer_context::{SpaceViewId, SpaceViewSystemExecutionError, ViewerContex use re_viewport_blueprint::ViewProperty; /// Wrapper over the `DataframeQuery` blueprint archetype that can also display some UI. -pub(crate) struct QueryV2 { +pub(crate) struct Query { query_property: ViewProperty, } -impl QueryV2 { +impl Query { /// Create a query object from the blueprint store. /// /// See the `blueprint_io` module for more related accessors. diff --git a/crates/viewer/re_space_view_dataframe/src/view_query_v2/ui.rs b/crates/viewer/re_space_view_dataframe/src/view_query/ui.rs similarity index 99% rename from crates/viewer/re_space_view_dataframe/src/view_query_v2/ui.rs rename to crates/viewer/re_space_view_dataframe/src/view_query/ui.rs index 1687a7719a21..95ee9f6604c7 100644 --- a/crates/viewer/re_space_view_dataframe/src/view_query_v2/ui.rs +++ b/crates/viewer/re_space_view_dataframe/src/view_query/ui.rs @@ -9,10 +9,10 @@ use re_types_core::{ComponentName, ComponentNameSet}; use re_ui::{list_item, UiExt}; use re_viewer_context::{SpaceViewId, SpaceViewSystemExecutionError, TimeDragValue, ViewerContext}; -use crate::view_query_v2::QueryV2; +use crate::view_query::Query; // UI implementation -impl QueryV2 { +impl Query { pub(super) fn timeline_ui( &self, ctx: &ViewerContext<'_>, From cbba7f290569107b92f89d1f070b9bdfed3efc3e Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Wed, 2 Oct 2024 19:33:58 +0200 Subject: [PATCH 4/5] mark as unreleased --- .../re_types/definitions/rerun/blueprint/views/dataframe.fbs | 3 ++- docs/content/reference/types/views/dataframe_view.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs index 2339372d1f92..bbbc00a2ad7b 100644 --- a/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs +++ b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs @@ -7,7 +7,8 @@ namespace rerun.blueprint.views; /// \example views/dataframe title="Use a blueprint to customize a DataframeView." //TODO(#6896): add a thumbnail when the example becomes interesting table DataframeView ( - "attr.rerun.view_identifier": "Dataframe" + "attr.rerun.view_identifier": "Dataframe", + "attr.docs.unreleased" ) { /// Query of the dataframe. query: rerun.blueprint.archetypes.DataframeQuery (order: 1000); diff --git a/docs/content/reference/types/views/dataframe_view.md b/docs/content/reference/types/views/dataframe_view.md index 1acd13261a75..36ccd2a7b19c 100644 --- a/docs/content/reference/types/views/dataframe_view.md +++ b/docs/content/reference/types/views/dataframe_view.md @@ -19,7 +19,7 @@ Query of the dataframe. * `select`: Selected columns. If unset, all columns are selected. ## API reference links - * 🐍 [Python API docs for `DataframeView`](https://ref.rerun.io/docs/python/stable/common/blueprint_views#rerun.blueprint.views.DataframeView) + * 🐍 [Python API docs for `DataframeView`](https://ref.rerun.io/docs/python/stable/common/blueprint_views?speculative-link#rerun.blueprint.views.DataframeView) ## Example From 941a9e38381e331f3f9b4f50a5f175cea12d554a Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Thu, 3 Oct 2024 10:57:54 +0200 Subject: [PATCH 5/5] Rename all instances of `schema` to either `view_columns` or `selected_columns`, depending on context --- .../src/dataframe_ui.rs | 34 ++++++++++--------- .../src/display_record_batch.rs | 21 +++++++----- .../src/space_view_class.rs | 19 ++++++----- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs b/crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs index f98b76ac0cad..370005a1bc90 100644 --- a/crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs +++ b/crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs @@ -37,32 +37,33 @@ pub(crate) fn dataframe_ui( ) -> Vec { re_tracing::profile_function!(); - let schema = query_handle + let selected_columns = query_handle .selected_contents() .iter() .map(|(_, desc)| desc.clone()) .collect::>(); // The table id mainly drives column widths, so it should be stable across queries leading to - // the same schema. However, changing the PoV typically leads to large changes of actual - // content. Since that can affect the optimal column width, we include the PoV in the salt. + // the same set of selected columns. However, changing the PoV typically leads to large changes + // of actual content. Since that can affect the optimal column width, we include the PoV in the + // salt. let table_id_salt = egui::Id::new("__dataframe__") - .with(&schema) + .with(&selected_columns) .with(&query_handle.query().filtered_point_of_view); // For the row expansion cache, we invalidate more aggressively for now. let row_expansion_id_salt = egui::Id::new("__dataframe_row_exp__") - .with(&schema) + .with(&selected_columns) .with(query_handle.query()); - let (header_groups, header_entity_paths) = column_groups_for_entity(&schema); + let (header_groups, header_entity_paths) = column_groups_for_entity(&selected_columns); let num_rows = query_handle.num_rows(); let mut table_delegate = DataframeTableDelegate { ctx, query_handle, - schema: &schema, + selected_columns: &selected_columns, header_entity_paths, num_rows, display_data: Err(anyhow::anyhow!( @@ -77,7 +78,7 @@ pub(crate) fn dataframe_ui( hide_column_actions: vec![], }; - let num_sticky_cols = schema + let num_sticky_cols = selected_columns .iter() .take_while(|cd| matches!(cd, ColumnDescriptor::Control(_) | ColumnDescriptor::Time(_))) .count(); @@ -86,7 +87,7 @@ pub(crate) fn dataframe_ui( egui_table::Table::new() .id_salt(table_id_salt) .columns( - schema + selected_columns .iter() .map(|column_descr| { egui_table::Column::new(200.0) @@ -143,12 +144,12 @@ impl RowsDisplayData { fn try_new( row_indices: &Range, row_data: Vec>>, - schema: &[ColumnDescriptor], + selected_columns: &[ColumnDescriptor], query_timeline: &Timeline, ) -> Result { let display_record_batches = row_data .into_iter() - .map(|data| DisplayRecordBatch::try_new(&data, schema)) + .map(|data| DisplayRecordBatch::try_new(&data, selected_columns)) .collect::, _>>()?; let mut batch_ref_from_row = BTreeMap::new(); @@ -162,7 +163,7 @@ impl RowsDisplayData { } // find the time column - let query_time_column_index = schema + let query_time_column_index = selected_columns .iter() .find_position(|desc| match desc { ColumnDescriptor::Time(time_column_desc) => { @@ -173,7 +174,7 @@ impl RowsDisplayData { .map(|(pos, _)| pos); // find the row id column - let row_id_column_index = schema + let row_id_column_index = selected_columns .iter() .find_position(|desc| match desc { ColumnDescriptor::Control(control_column_desc) => { @@ -196,7 +197,7 @@ impl RowsDisplayData { struct DataframeTableDelegate<'a> { ctx: &'a ViewerContext<'a>, query_handle: &'a QueryHandle<'a>, - schema: &'a [ColumnDescriptor], + selected_columns: &'a [ColumnDescriptor], header_entity_paths: Vec>, display_data: anyhow::Result, @@ -222,7 +223,8 @@ impl<'a> egui_table::TableDelegate for DataframeTableDelegate<'a> { .take((info.visible_rows.end - info.visible_rows.start) as usize) .collect(); - let data = RowsDisplayData::try_new(&info.visible_rows, data, self.schema, &timeline); + let data = + RowsDisplayData::try_new(&info.visible_rows, data, self.selected_columns, &timeline); self.display_data = data.context("Failed to create display data"); } @@ -264,7 +266,7 @@ impl<'a> egui_table::TableDelegate for DataframeTableDelegate<'a> { ); } } else if cell.row_nr == 1 { - let column = &self.schema[cell.col_range.start]; + let column = &self.selected_columns[cell.col_range.start]; // if this column can actually be hidden, then that's the corresponding action let hide_action = match column { diff --git a/crates/viewer/re_space_view_dataframe/src/display_record_batch.rs b/crates/viewer/re_space_view_dataframe/src/display_record_batch.rs index 88046b3ea75b..4c1a92468919 100644 --- a/crates/viewer/re_space_view_dataframe/src/display_record_batch.rs +++ b/crates/viewer/re_space_view_dataframe/src/display_record_batch.rs @@ -1,5 +1,5 @@ -//! Intermediate data structures to make `re_datastore`'s schemas and row data more amenable to -//! displaying in a table. +//! Intermediate data structures to make `re_datastore`'s row data more amenable to displaying in a +//! table. use thiserror::Error; @@ -187,10 +187,10 @@ pub(crate) enum DisplayColumn { impl DisplayColumn { #[allow(clippy::borrowed_box)] // https://github.com/rust-lang/rust-clippy/issues/11940 fn try_new( - column_schema: &ColumnDescriptor, + column_descriptor: &ColumnDescriptor, column_data: &Box, ) -> Result { - match column_schema { + match column_descriptor { ColumnDescriptor::Control(desc) => { if desc.component_name == RowId::name() { let row_ids = column_data @@ -373,19 +373,22 @@ pub(crate) struct DisplayRecordBatch { } impl DisplayRecordBatch { - /// Create a new `DisplayRecordBatch` from a `RecordBatch` and its schema. + /// Create a new `DisplayRecordBatch` from a `RecordBatch` and its list of selected columns. /// - /// The columns in the record batch must match the schema. This is guaranteed by `re_datastore`. + /// The columns in the record batch must match the selected columns. This is guaranteed by + /// `re_datastore`. pub(crate) fn try_new( row_data: &Vec>, - schema: &[ColumnDescriptor], + selected_columns: &[ColumnDescriptor], ) -> Result { let num_rows = row_data.first().map(|arr| arr.len()).unwrap_or(0); - let columns: Result, _> = schema + let columns: Result, _> = selected_columns .iter() .zip(row_data) - .map(|(column_schema, column_data)| DisplayColumn::try_new(column_schema, column_data)) + .map(|(column_descriptor, column_data)| { + DisplayColumn::try_new(column_descriptor, column_data) + }) .collect(); Ok(Self { 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 93152b59107b..1421ab9d2683 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 @@ -17,8 +17,8 @@ struct DataframeSpaceViewState { /// Cache for the expanded rows. expended_rows_cache: ExpandedRowsCache, - /// Schema for the current query, cached here for the column visibility UI. - schema: Option>, + /// List of view columns for the current query, cached here for the column visibility UI. + view_columns: Option>, } impl SpaceViewState for DataframeSpaceViewState { @@ -106,12 +106,12 @@ mode sets the default time range to _everything_. You can override this in the s ) -> Result<(), SpaceViewSystemExecutionError> { let state = state.downcast_mut::()?; let view_query = view_query::Query::from_blueprint(ctx, space_view_id); - let Some(schema) = &state.schema else { + let Some(view_columns) = &state.view_columns else { // Shouldn't happen, except maybe on the first frame, which is too early // for the user to click the menu anyway. return Ok(()); }; - view_query.selection_panel_ui(ctx, ui, space_view_id, schema) + view_query.selection_panel_ui(ctx, ui, space_view_id, view_columns) } fn ui( @@ -150,8 +150,9 @@ mode sets the default time range to _everything_. You can override this in the s SparseFillStrategy::None }; - let schema = query_engine.schema_for_view_contents(&view_contents); - let selection = view_query.apply_column_visibility_to_view_columns(ctx, &schema)?; + let view_columns = query_engine.schema_for_view_contents(&view_contents); + let selected_columns = + view_query.apply_column_visibility_to_view_columns(ctx, &view_columns)?; let dataframe_query = re_chunk_store::QueryExpression2 { view_contents: Some(view_contents), @@ -159,7 +160,7 @@ mode sets the default time range to _everything_. You can override this in the s filtered_index_range: Some(view_query.filter_by_range()?), filtered_point_of_view, sparse_fill_strategy, - selection, + selection: selected_columns, // not yet unsupported by the dataframe view filtered_index_values: None, @@ -171,9 +172,9 @@ mode sets the default time range to _everything_. You can override this in the s let hide_column_actions = dataframe_ui(ctx, ui, &query_handle, &mut state.expended_rows_cache); - view_query.handle_hide_column_actions(ctx, &schema, hide_column_actions)?; + view_query.handle_hide_column_actions(ctx, &view_columns, hide_column_actions)?; - state.schema = Some(schema); + state.view_columns = Some(view_columns); Ok(()) } }