Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix silently interpreting zero time range as latest-at query #6172

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/re_entity_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ pub(crate) use self::entity_tree::{ClearCascade, CompactedStoreEvents};
use re_log_types::DataTableError;
pub use re_log_types::{EntityPath, EntityPathPart, TimeInt, Timeline};

pub use re_query::{ExtraQueryHistory, VisibleHistory, VisibleHistoryBoundary};

#[cfg(feature = "serde")]
pub use blueprint::components::EntityPropertiesComponent;
#[cfg(feature = "serde")]
Expand Down
7 changes: 6 additions & 1 deletion crates/re_log_types/src/time_point/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ impl TimeType {
}

#[inline]
pub fn format(&self, time_int: TimeInt, time_zone_for_timestamps: TimeZone) -> String {
pub fn format(
&self,
time_int: impl Into<TimeInt>,
time_zone_for_timestamps: TimeZone,
) -> String {
let time_int = time_int.into();
match time_int {
TimeInt::STATIC => "<static>".into(),
// TODO(#5264): remove time panel hack once we migrate to the new static UI
Expand Down
16 changes: 16 additions & 0 deletions crates/re_log_types/src/time_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ impl TimeRange {
max: self.max.max(other.max),
}
}

pub fn from_visible_time_range(
range: &re_types_core::datatypes::VisibleTimeRange,
cursor: impl Into<re_types_core::datatypes::TimeInt>,
) -> Self {
let cursor = cursor.into();

let mut min = range.start.start_boundary_time(cursor);
let mut max = range.end.end_boundary_time(cursor);

if min > max {
std::mem::swap(&mut min, &mut max);
}

Self::new(min, max)
}
}

impl re_types_core::SizeBytes for TimeRange {
Expand Down
2 changes: 0 additions & 2 deletions crates/re_query/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod flat_vec_deque;
mod latest_at;
mod promise;
mod range;
mod visible_history;

pub mod clamped_zip;
pub mod range_zip;
Expand All @@ -19,7 +18,6 @@ pub use self::latest_at::{LatestAtComponentResults, LatestAtMonoResult, LatestAt
pub use self::promise::{Promise, PromiseId, PromiseResolver, PromiseResult};
pub use self::range::{RangeComponentResults, RangeData, RangeResults};
pub use self::range_zip::*;
pub use self::visible_history::{ExtraQueryHistory, VisibleHistory, VisibleHistoryBoundary};

pub(crate) use self::latest_at::LatestAtCache;
pub(crate) use self::range::{RangeCache, RangeComponentResultsInner};
Expand Down
126 changes: 0 additions & 126 deletions crates/re_query/src/visible_history.rs

This file was deleted.

6 changes: 0 additions & 6 deletions crates/re_space_view/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ mod screenshot;
mod space_view;
mod space_view_contents;
mod sub_archetypes; // TODO(andreas): better name before `sub_archetype` sticks around?
mod visual_time_range;
mod visualizable;

pub use data_query::{DataQuery, EntityOverrideContext, PropertyResolver};
Expand All @@ -21,11 +20,6 @@ pub use sub_archetypes::{
edit_blueprint_component, entity_path_for_view_property, get_blueprint_component,
query_view_property, query_view_property_or_default, view_property,
};
pub use visual_time_range::{
query_visual_history, time_range_from_visible_time_range,
visible_history_boundary_from_time_range_boundary,
visible_history_boundary_to_time_range_boundary,
};
pub use visualizable::determine_visualizable_entities;

pub mod external {
Expand Down
107 changes: 0 additions & 107 deletions crates/re_space_view/src/visual_time_range.rs

This file was deleted.

Loading
Loading