From 60ce5dca5416563726a35cbab0ecbf3a0898791c Mon Sep 17 00:00:00 2001 From: Antoine Beyeler <49431240+abey79@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:40:08 +0200 Subject: [PATCH] Dataframe view update and blueprint API (part 6): cleanup (#7573) ### What - Closes #6896 - Closes #7498 Final PR in the series. Pure cleanup. - removes dead fbs - rename stuff - mark stuff as unreleased - rename `schema` to `view_columns` or `selected_columns`, depending on context (see [this comment](https://github.com/rerun-io/rerun/pull/7527#discussion_r1785833666))
Part of a series to address #6896 and #7498. All PRs: - #7515 - #7516 - #7527 - #7545 - #7551 - #7572 - #7573 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7573?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7573?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/7573) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. --- .../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 - .../rerun/blueprint/views/dataframe.fbs | 5 +- .../src/blueprint/archetypes/.gitattributes | 1 - .../blueprint/archetypes/dataframe_query.rs | 183 +++--- .../archetypes/dataframe_query_v2.rs | 306 ---------- .../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/views/dataframe_view.rs | 16 +- .../src/dataframe_ui.rs | 34 +- .../src/display_record_batch.rs | 21 +- .../viewer/re_space_view_dataframe/src/lib.rs | 2 +- .../src/space_view_class.rs | 25 +- .../blueprint.rs | 4 +- .../src/{view_query_v2 => view_query}/mod.rs | 8 +- .../src/{view_query_v2 => view_query}/ui.rs | 4 +- .../src/blueprint/validation_gen/mod.rs | 6 - crates/viewer/re_viewer/src/reflection/mod.rs | 45 -- .../reference/types/views/dataframe_view.md | 2 +- docs/snippets/all/views/dataframe.py | 2 +- rerun_cpp/src/rerun/blueprint/archetypes.hpp | 1 - .../rerun/blueprint/archetypes/.gitattributes | 2 - .../blueprint/archetypes/dataframe_query.cpp | 19 +- .../blueprint/archetypes/dataframe_query.hpp | 69 ++- .../archetypes/dataframe_query_v2.cpp | 54 -- .../archetypes/dataframe_query_v2.hpp | 116 ---- 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 | 85 +-- ...query_v2_ext.py => dataframe_query_ext.py} | 6 +- .../archetypes/dataframe_query_v2.py | 92 --- .../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 - .../rerun/blueprint/views/dataframe_view.py | 10 +- .../tests/unit/test_dataframe_view_query.py | 6 +- 77 files changed, 261 insertions(+), 3867 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_v2.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 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 (90%) rename crates/viewer/re_space_view_dataframe/src/{view_query_v2 => view_query}/ui.rs (99%) delete mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp delete mode 100644 rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.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 rename rerun_py/rerun_sdk/rerun/blueprint/archetypes/{dataframe_query_v2_ext.py => dataframe_query_ext.py} (92%) delete mode 100644 rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.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..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 @@ -1,63 +1,12 @@ 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" -) { - // --- Optional --- - /// The timeline for this query. /// /// If unset, the timeline currently active on the time panel is used. 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/definitions/rerun/blueprint/views/dataframe.fbs b/crates/store/re_types/definitions/rerun/blueprint/views/dataframe.fbs index 94fe9c936273..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,8 +7,9 @@ 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.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 ced82b80ceda..8275cbf12a81 100644 --- a/crates/store/re_types/src/blueprint/archetypes/.gitattributes +++ b/crates/store/re_types/src/blueprint/archetypes/.gitattributes @@ -3,7 +3,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 scalar_axis.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 index 29205b3c7810..7c3d77476cbd 100644 --- a/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs +++ b/crates/store/re_types/src/blueprint/archetypes/dataframe_query.rs @@ -23,38 +23,41 @@ use ::re_types_core::{DeserializationError, DeserializationResult}; 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. + /// If unset, the timeline currently active on the time panel is used. pub timeline: Option, - /// Kind of query: latest-at or range. - pub kind: Option, - - /// Configuration for latest-at queries. + /// If provided, only rows whose timestamp is within this range will be shown. /// - /// Note: configuration as saved on a per-timeline basis. - pub latest_at_queries: Option, + /// Note: will be unset as soon as `timeline` is changed. + pub filter_by_range: Option, - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - pub time_range_queries: Option, + /// If provided, only show rows which contains a logged event for the specified component. + pub filter_by_event: Option, + + /// Should empty cells be filled with latest-at queries? + pub apply_latest_at: Option, + + /// Selected columns. If unset, all columns are selected. + pub select: 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() + + self.filter_by_range.heap_size_bytes() + + self.filter_by_event.heap_size_bytes() + + self.apply_latest_at.heap_size_bytes() + + self.select.heap_size_bytes() } #[inline] fn is_pod() -> bool { >::is_pod() - && >::is_pod() - && >::is_pod() - && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() + && >::is_pod() } } @@ -64,30 +67,32 @@ static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> = static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> = once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.DataframeQueryIndicator".into()]); -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 4usize]> = +static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = 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(), + "rerun.blueprint.components.FilterByRange".into(), + "rerun.blueprint.components.FilterByEvent".into(), + "rerun.blueprint.components.ApplyLatestAt".into(), + "rerun.blueprint.components.SelectedColumns".into(), ] }); -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = +static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = 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(), + "rerun.blueprint.components.FilterByRange".into(), + "rerun.blueprint.components.FilterByEvent".into(), + "rerun.blueprint.components.ApplyLatestAt".into(), + "rerun.blueprint.components.SelectedColumns".into(), ] }); impl DataframeQuery { - /// The total number of components in the archetype: 0 required, 1 recommended, 4 optional - pub const NUM_COMPONENTS: usize = 5usize; + /// The total number of components in the archetype: 0 required, 1 recommended, 5 optional + pub const NUM_COMPONENTS: usize = 6usize; } /// Indicator component for the [`DataframeQuery`] [`::re_types_core::Archetype`] @@ -152,41 +157,52 @@ impl ::re_types_core::Archetype for DataframeQuery { } 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")? + 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.DataframeQuery#filter_by_range")? + .into_iter() + .next() + .flatten() + } else { + None + }; + 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.DataframeQuery#filter_by_event")? + .into_iter() + .next() + .flatten() + } else { + None + }; + 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.DataframeQuery#apply_latest_at")? + .into_iter() + .next() + .flatten() + } else { + None + }; + let select = + if let Some(array) = arrays_by_name.get("rerun.blueprint.components.SelectedColumns") { + ::from_arrow_opt(&**array) + .with_context("rerun.blueprint.archetypes.DataframeQuery#select")? .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, + filter_by_range, + filter_by_event, + apply_latest_at, + select, }) } } @@ -200,13 +216,16 @@ impl ::re_types_core::AsComponents for DataframeQuery { self.timeline .as_ref() .map(|comp| (comp as &dyn ComponentBatch).into()), - self.kind + self.filter_by_range .as_ref() .map(|comp| (comp as &dyn ComponentBatch).into()), - self.latest_at_queries + self.filter_by_event .as_ref() .map(|comp| (comp as &dyn ComponentBatch).into()), - self.time_range_queries + self.apply_latest_at + .as_ref() + .map(|comp| (comp as &dyn ComponentBatch).into()), + self.select .as_ref() .map(|comp| (comp as &dyn ComponentBatch).into()), ] @@ -224,15 +243,16 @@ impl DataframeQuery { pub fn new() -> Self { Self { timeline: None, - kind: None, - latest_at_queries: None, - time_range_queries: None, + filter_by_range: None, + filter_by_event: None, + apply_latest_at: None, + select: 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. + /// If unset, the timeline currently active on the time panel is used. #[inline] pub fn with_timeline( mut self, @@ -242,34 +262,45 @@ impl DataframeQuery { self } - /// Kind of query: latest-at or range. + /// If provided, only rows whose timestamp is within this range will be shown. + /// + /// Note: will be unset as soon as `timeline` is changed. #[inline] - pub fn with_kind(mut self, kind: impl Into) -> Self { - self.kind = Some(kind.into()); + pub fn with_filter_by_range( + mut self, + filter_by_range: impl Into, + ) -> Self { + self.filter_by_range = Some(filter_by_range.into()); self } - /// Configuration for latest-at queries. - /// - /// Note: configuration as saved on a per-timeline basis. + /// If provided, only show rows which contains a logged event for the specified component. #[inline] - pub fn with_latest_at_queries( + pub fn with_filter_by_event( mut self, - latest_at_queries: impl Into, + filter_by_event: impl Into, ) -> Self { - self.latest_at_queries = Some(latest_at_queries.into()); + self.filter_by_event = Some(filter_by_event.into()); self } - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. + /// Should empty cells be filled with latest-at queries? + #[inline] + pub fn with_apply_latest_at( + mut self, + apply_latest_at: impl Into, + ) -> Self { + self.apply_latest_at = Some(apply_latest_at.into()); + self + } + + /// Selected columns. If unset, all columns are selected. #[inline] - pub fn with_time_range_queries( + pub fn with_select( mut self, - time_range_queries: impl Into, + select: impl Into, ) -> Self { - self.time_range_queries = Some(time_range_queries.into()); + self.select = Some(select.into()); self } } diff --git a/crates/store/re_types/src/blueprint/archetypes/dataframe_query_v2.rs b/crates/store/re_types/src/blueprint/archetypes/dataframe_query_v2.rs deleted file mode 100644 index 754e4e3f161e..000000000000 --- a/crates/store/re_types/src/blueprint/archetypes/dataframe_query_v2.rs +++ /dev/null @@ -1,306 +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 DataframeQueryV2 { - /// The timeline for this query. - /// - /// If unset, the timeline currently active on the time panel is used. - pub timeline: Option, - - /// If provided, only rows whose timestamp is within this range will be shown. - /// - /// Note: will be unset as soon as `timeline` is changed. - pub filter_by_range: Option, - - /// If provided, only show rows which contains a logged event for the specified component. - pub filter_by_event: Option, - - /// Should empty cells be filled with latest-at queries? - pub apply_latest_at: Option, - - /// Selected columns. If unset, all columns are selected. - pub select: Option, -} - -impl ::re_types_core::SizeBytes for DataframeQueryV2 { - #[inline] - fn heap_size_bytes(&self) -> u64 { - self.timeline.heap_size_bytes() - + self.filter_by_range.heap_size_bytes() - + self.filter_by_event.heap_size_bytes() - + self.apply_latest_at.heap_size_bytes() - + self.select.heap_size_bytes() - } - - #[inline] - fn is_pod() -> bool { - >::is_pod() - && >::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.DataframeQueryV2Indicator".into()]); - -static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 5usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.TimelineName".into(), - "rerun.blueprint.components.FilterByRange".into(), - "rerun.blueprint.components.FilterByEvent".into(), - "rerun.blueprint.components.ApplyLatestAt".into(), - "rerun.blueprint.components.SelectedColumns".into(), - ] - }); - -static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 6usize]> = - once_cell::sync::Lazy::new(|| { - [ - "rerun.blueprint.components.DataframeQueryV2Indicator".into(), - "rerun.blueprint.components.TimelineName".into(), - "rerun.blueprint.components.FilterByRange".into(), - "rerun.blueprint.components.FilterByEvent".into(), - "rerun.blueprint.components.ApplyLatestAt".into(), - "rerun.blueprint.components.SelectedColumns".into(), - ] - }); - -impl DataframeQueryV2 { - /// 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; - -impl ::re_types_core::Archetype for DataframeQueryV2 { - type Indicator = DataframeQueryV2Indicator; - - #[inline] - fn name() -> ::re_types_core::ArchetypeName { - "rerun.blueprint.archetypes.DataframeQueryV2".into() - } - - #[inline] - fn display_name() -> &'static str { - "Dataframe query v2" - } - - #[inline] - fn indicator() -> MaybeOwnedComponentBatch<'static> { - static INDICATOR: DataframeQueryV2Indicator = DataframeQueryV2Indicator::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.DataframeQueryV2#timeline")? - .into_iter() - .next() - .flatten() - } else { - None - }; - 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")? - .into_iter() - .next() - .flatten() - } else { - None - }; - 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")? - .into_iter() - .next() - .flatten() - } else { - None - }; - 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")? - .into_iter() - .next() - .flatten() - } else { - None - }; - 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")? - .into_iter() - .next() - .flatten() - } else { - None - }; - Ok(Self { - timeline, - filter_by_range, - filter_by_event, - apply_latest_at, - select, - }) - } -} - -impl ::re_types_core::AsComponents for DataframeQueryV2 { - 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.filter_by_range - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.filter_by_event - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.apply_latest_at - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - self.select - .as_ref() - .map(|comp| (comp as &dyn ComponentBatch).into()), - ] - .into_iter() - .flatten() - .collect() - } -} - -impl ::re_types_core::ArchetypeReflectionMarker for DataframeQueryV2 {} - -impl DataframeQueryV2 { - /// Create a new `DataframeQueryV2`. - #[inline] - pub fn new() -> Self { - Self { - timeline: None, - filter_by_range: None, - filter_by_event: None, - apply_latest_at: None, - select: None, - } - } - - /// The timeline for this query. - /// - /// If unset, the timeline currently active on the time panel is used. - #[inline] - pub fn with_timeline( - mut self, - timeline: impl Into, - ) -> Self { - self.timeline = Some(timeline.into()); - self - } - - /// If provided, only rows whose timestamp is within this range will be shown. - /// - /// Note: will be unset as soon as `timeline` is changed. - #[inline] - pub fn with_filter_by_range( - mut self, - filter_by_range: impl Into, - ) -> Self { - self.filter_by_range = Some(filter_by_range.into()); - self - } - - /// If provided, only show rows which contains a logged event for the specified component. - #[inline] - pub fn with_filter_by_event( - mut self, - filter_by_event: impl Into, - ) -> Self { - self.filter_by_event = Some(filter_by_event.into()); - self - } - - /// Should empty cells be filled with latest-at queries? - #[inline] - pub fn with_apply_latest_at( - mut self, - apply_latest_at: impl Into, - ) -> Self { - self.apply_latest_at = Some(apply_latest_at.into()); - self - } - - /// Selected columns. If unset, all columns are selected. - #[inline] - pub fn with_select( - mut self, - select: impl Into, - ) -> Self { - self.select = Some(select.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..19f7dfedff0c 100644 --- a/crates/store/re_types/src/blueprint/archetypes/mod.rs +++ b/crates/store/re_types/src/blueprint/archetypes/mod.rs @@ -2,7 +2,6 @@ mod background; mod dataframe_query; -mod dataframe_query_v2; mod plot_legend; mod scalar_axis; mod space_view_blueprint; @@ -16,7 +15,6 @@ 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; pub use self::space_view_blueprint::SpaceViewBlueprint; 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/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/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/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..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 @@ -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}; @@ -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 { @@ -105,13 +105,13 @@ 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 Some(schema) = &state.schema else { + let view_query = view_query::Query::from_blueprint(ctx, space_view_id); + 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( @@ -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(), @@ -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(()) } } 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 90% 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 7c505bf345ab..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 @@ -6,18 +6,18 @@ 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. -pub(crate) struct QueryV2 { +/// Wrapper over the `DataframeQuery` blueprint archetype that can also display some UI. +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. 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_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<'_>, 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..92e4eb2f0358 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 { @@ -1582,30 +1561,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 { - display_name: "Dataframe query v2", fields: vec![ ArchetypeFieldReflection { component_name : "rerun.blueprint.components.TimelineName".into(), display_name : 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 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 3915908e6432..eae71f6b2164 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes.hpp @@ -5,7 +5,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" #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 c4a06635d4c0..40240eeaa29b 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_cpp/src/rerun/blueprint/archetypes/.gitattributes @@ -7,8 +7,6 @@ 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 panel_blueprint.hpp linguist-generated=true plot_legend.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 index 0bd53a79fd93..aee5527b2269 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.cpp @@ -15,25 +15,30 @@ namespace rerun { ) { using namespace blueprint::archetypes; std::vector cells; - cells.reserve(5); + cells.reserve(6); 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()); + if (archetype.filter_by_range.has_value()) { + auto result = ComponentBatch::from_loggable(archetype.filter_by_range.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()); + if (archetype.filter_by_event.has_value()) { + auto result = ComponentBatch::from_loggable(archetype.filter_by_event.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()); + if (archetype.apply_latest_at.has_value()) { + auto result = ComponentBatch::from_loggable(archetype.apply_latest_at.value()); + RR_RETURN_NOT_OK(result.error); + cells.push_back(std::move(result.value)); + } + if (archetype.select.has_value()) { + auto result = ComponentBatch::from_loggable(archetype.select.value()); RR_RETURN_NOT_OK(result.error); cells.push_back(std::move(result.value)); } diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp index 696a4ca139d1..5ced1636767a 100644 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp +++ b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query.hpp @@ -3,9 +3,10 @@ #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/apply_latest_at.hpp" +#include "../../blueprint/components/filter_by_event.hpp" +#include "../../blueprint/components/filter_by_range.hpp" +#include "../../blueprint/components/selected_columns.hpp" #include "../../blueprint/components/timeline_name.hpp" #include "../../collection.hpp" #include "../../compiler_utils.hpp" @@ -23,21 +24,22 @@ namespace rerun::blueprint::archetypes { 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. + /// If unset, the timeline currently active on the time panel is used. std::optional timeline; - /// Kind of query: latest-at or range. - std::optional kind; - - /// Configuration for latest-at queries. + /// If provided, only rows whose timestamp is within this range will be shown. /// - /// Note: configuration as saved on a per-timeline basis. - std::optional latest_at_queries; + /// Note: will be unset as soon as `timeline` is changed. + std::optional filter_by_range; - /// Configuration for the time range queries. - /// - /// Note: configuration as saved on a per-timeline basis. - std::optional time_range_queries; + /// If provided, only show rows which contains a logged event for the specified component. + std::optional filter_by_event; + + /// Should empty cells be filled with latest-at queries? + std::optional apply_latest_at; + + /// Selected columns. If unset, all columns are selected. + std::optional select; public: static constexpr const char IndicatorComponentName[] = @@ -52,38 +54,45 @@ namespace rerun::blueprint::archetypes { /// 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. + /// If unset, the timeline currently active on the time panel is used. 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); + /// If provided, only rows whose timestamp is within this range will be shown. + /// + /// Note: will be unset as soon as `timeline` is changed. + DataframeQuery with_filter_by_range( + rerun::blueprint::components::FilterByRange _filter_by_range + ) && { + filter_by_range = std::move(_filter_by_range); // 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 + /// If provided, only show rows which contains a logged event for the specified component. + DataframeQuery with_filter_by_event( + rerun::blueprint::components::FilterByEvent _filter_by_event ) && { - latest_at_queries = std::move(_latest_at_queries); + filter_by_event = std::move(_filter_by_event); // 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 + /// Should empty cells be filled with latest-at queries? + DataframeQuery with_apply_latest_at( + rerun::blueprint::components::ApplyLatestAt _apply_latest_at ) && { - time_range_queries = std::move(_time_range_queries); + apply_latest_at = std::move(_apply_latest_at); + // See: https://github.com/rerun-io/rerun/issues/4027 + RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) + } + + /// Selected columns. If unset, all columns are selected. + 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);) } diff --git a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp deleted file mode 100644 index 975951588686..000000000000 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.cpp +++ /dev/null @@ -1,54 +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_v2.hpp" - -#include "../../collection_adapter_builtins.hpp" - -namespace rerun::blueprint::archetypes {} - -namespace rerun { - - Result> - AsComponents::serialize( - const blueprint::archetypes::DataframeQueryV2& archetype - ) { - using namespace blueprint::archetypes; - std::vector cells; - cells.reserve(6); - - 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.filter_by_range.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.filter_by_range.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.filter_by_event.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.filter_by_event.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.apply_latest_at.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.apply_latest_at.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - if (archetype.select.has_value()) { - auto result = ComponentBatch::from_loggable(archetype.select.value()); - RR_RETURN_NOT_OK(result.error); - cells.push_back(std::move(result.value)); - } - { - auto indicator = DataframeQueryV2::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_v2.hpp b/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.hpp deleted file mode 100644 index a208d87021c7..000000000000 --- a/rerun_cpp/src/rerun/blueprint/archetypes/dataframe_query_v2.hpp +++ /dev/null @@ -1,116 +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/apply_latest_at.hpp" -#include "../../blueprint/components/filter_by_event.hpp" -#include "../../blueprint/components/filter_by_range.hpp" -#include "../../blueprint/components/selected_columns.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 DataframeQueryV2 { - /// The timeline for this query. - /// - /// If unset, the timeline currently active on the time panel is used. - std::optional timeline; - - /// If provided, only rows whose timestamp is within this range will be shown. - /// - /// Note: will be unset as soon as `timeline` is changed. - std::optional filter_by_range; - - /// If provided, only show rows which contains a logged event for the specified component. - std::optional filter_by_event; - - /// Should empty cells be filled with latest-at queries? - std::optional apply_latest_at; - - /// Selected columns. If unset, all columns are selected. - std::optional select; - - public: - static constexpr const char IndicatorComponentName[] = - "rerun.blueprint.components.DataframeQueryV2Indicator"; - - /// 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; - - /// 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) && { - timeline = std::move(_timeline); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// 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( - rerun::blueprint::components::FilterByRange _filter_by_range - ) && { - filter_by_range = std::move(_filter_by_range); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// If provided, only show rows which contains a logged event for the specified component. - DataframeQueryV2 with_filter_by_event( - rerun::blueprint::components::FilterByEvent _filter_by_event - ) && { - filter_by_event = std::move(_filter_by_event); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// Should empty cells be filled with latest-at queries? - DataframeQueryV2 with_apply_latest_at( - rerun::blueprint::components::ApplyLatestAt _apply_latest_at - ) && { - apply_latest_at = std::move(_apply_latest_at); - // See: https://github.com/rerun-io/rerun/issues/4027 - RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);) - } - - /// Selected columns. If unset, all columns are selected. - DataframeQueryV2 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);) - } - }; - -} // 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::DataframeQueryV2& 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..1db9a825f2e9 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/.gitattributes @@ -5,7 +5,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 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 2eefb2ec1ef0..423f025dc7aa 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/__init__.py @@ -5,7 +5,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 from .scalar_axis import ScalarAxis @@ -22,7 +21,6 @@ "Background", "ContainerBlueprint", "DataframeQuery", - "DataframeQueryV2", "PanelBlueprint", "PlotLegend", "ScalarAxis", diff --git a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py index dec9b487e8e0..e624479321ee 100644 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py +++ b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query.py @@ -5,69 +5,31 @@ 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 +from .dataframe_query_ext import DataframeQueryExt __all__ = ["DataframeQuery"] @define(str=False, repr=False, init=False) -class DataframeQuery(Archetype): +class DataframeQuery(DataframeQueryExt, 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__() + # __init__ can be found in dataframe_query_ext.py 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] + filter_by_range=None, # type: ignore[arg-type] + filter_by_event=None, # type: ignore[arg-type] + apply_latest_at=None, # type: ignore[arg-type] + select=None, # type: ignore[arg-type] ) @classmethod @@ -84,38 +46,45 @@ def _clear(cls) -> 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. + # If unset, the timeline currently active on the time panel is used. # # (Docstring intentionally commented out to hide this field from the docs) - kind: blueprint_components.QueryKindBatch | None = field( + filter_by_range: blueprint_components.FilterByRangeBatch | None = field( metadata={"component": "optional"}, default=None, - converter=blueprint_components.QueryKindBatch._optional, # type: ignore[misc] + converter=blueprint_components.FilterByRangeBatch._optional, # type: ignore[misc] ) - # Kind of query: latest-at or range. + # If provided, only rows whose timestamp is within this range will be shown. + # + # Note: will be unset as soon as `timeline` is changed. # # (Docstring intentionally commented out to hide this field from the docs) - latest_at_queries: blueprint_components.LatestAtQueriesBatch | None = field( + filter_by_event: blueprint_components.FilterByEventBatch | None = field( metadata={"component": "optional"}, default=None, - converter=blueprint_components.LatestAtQueriesBatch._optional, # type: ignore[misc] + converter=blueprint_components.FilterByEventBatch._optional, # type: ignore[misc] ) - # Configuration for latest-at queries. - # - # Note: configuration as saved on a per-timeline basis. + # If provided, only show rows which contains a logged event for the specified component. # # (Docstring intentionally commented out to hide this field from the docs) - time_range_queries: blueprint_components.TimeRangeQueriesBatch | None = field( + apply_latest_at: blueprint_components.ApplyLatestAtBatch | None = field( metadata={"component": "optional"}, default=None, - converter=blueprint_components.TimeRangeQueriesBatch._optional, # type: ignore[misc] + converter=blueprint_components.ApplyLatestAtBatch._optional, # type: ignore[misc] ) - # Configuration for the time range queries. + # Should empty cells be filled with latest-at queries? # - # Note: configuration as saved on a per-timeline basis. + # (Docstring intentionally commented out to hide this field from the docs) + + select: blueprint_components.SelectedColumnsBatch | None = field( + metadata={"component": "optional"}, + default=None, + converter=blueprint_components.SelectedColumnsBatch._optional, # type: ignore[misc] + ) + # Selected columns. If unset, all columns are selected. # # (Docstring intentionally commented out to hide this field from the docs) 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/archetypes/dataframe_query_v2.py b/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.py deleted file mode 100644 index 9c7e702f1df4..000000000000 --- a/rerun_py/rerun_sdk/rerun/blueprint/archetypes/dataframe_query_v2.py +++ /dev/null @@ -1,92 +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 "DataframeQueryV2Ext" class in "dataframe_query_v2_ext.py". - -from __future__ import annotations - -from attrs import define, field - -from ..._baseclasses import ( - Archetype, -) -from ...blueprint import components as blueprint_components -from .dataframe_query_v2_ext import DataframeQueryV2Ext - -__all__ = ["DataframeQueryV2"] - - -@define(str=False, repr=False, init=False) -class DataframeQueryV2(DataframeQueryV2Ext, Archetype): - """**Archetype**: The query for the dataframe view.""" - - # __init__ can be found in dataframe_query_v2_ext.py - - def __attrs_clear__(self) -> None: - """Convenience method for calling `__attrs_init__` with all `None`s.""" - self.__attrs_init__( - timeline=None, # type: ignore[arg-type] - filter_by_range=None, # type: ignore[arg-type] - filter_by_event=None, # type: ignore[arg-type] - apply_latest_at=None, # type: ignore[arg-type] - select=None, # type: ignore[arg-type] - ) - - @classmethod - def _clear(cls) -> DataframeQueryV2: - """Produce an empty DataframeQueryV2, 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, the timeline currently active on the time panel is used. - # - # (Docstring intentionally commented out to hide this field from the docs) - - filter_by_range: blueprint_components.FilterByRangeBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.FilterByRangeBatch._optional, # type: ignore[misc] - ) - # If provided, only rows whose timestamp is within this range will be shown. - # - # Note: will be unset as soon as `timeline` is changed. - # - # (Docstring intentionally commented out to hide this field from the docs) - - filter_by_event: blueprint_components.FilterByEventBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.FilterByEventBatch._optional, # type: ignore[misc] - ) - # If provided, only show rows which contains a logged event for the specified component. - # - # (Docstring intentionally commented out to hide this field from the docs) - - apply_latest_at: blueprint_components.ApplyLatestAtBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.ApplyLatestAtBatch._optional, # type: ignore[misc] - ) - # Should empty cells be filled with latest-at queries? - # - # (Docstring intentionally commented out to hide this field from the docs) - - select: blueprint_components.SelectedColumnsBatch | None = field( - metadata={"component": "optional"}, - default=None, - converter=blueprint_components.SelectedColumnsBatch._optional, # type: ignore[misc] - ) - # Selected columns. If unset, all columns are selected. - # - # (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) 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(