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

Use less "arrow" in re_viewer #1105

Merged
merged 2 commits into from
Feb 6, 2023
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
6 changes: 3 additions & 3 deletions crates/re_data_store/src/entity_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ pub fn query_transform(
// Although it would be nice to use the `re_query` helpers for this, we would need to move
// this out of re_data_store to avoid a circular dep. Since we don't need to do a join for
// transforms this is easy enough.
let arrow_store = &entity_db.arrow_store;
let data_store = &entity_db.data_store;

let components = [Transform::name()];

let row_indices = arrow_store.latest_at(query, entity_path, Transform::name(), &components)?;
let row_indices = data_store.latest_at(query, entity_path, Transform::name(), &components)?;

let results = arrow_store.get(&components, &row_indices);
let results = data_store.get(&components, &row_indices);
let arr = results.get(0)?.as_ref()?.as_ref();

let mut iter = arrow_array_deserialize_iterator::<Transform>(arr).ok()?;
Expand Down
20 changes: 10 additions & 10 deletions crates/re_data_store/src/log_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pub struct EntityDb {
/// A tree-view (split on path components) of the entities.
pub tree: crate::EntityTree,

/// The arrow store of data.
pub arrow_store: re_arrow_store::DataStore,
/// Stores all components for all entities for all timelines.
pub data_store: re_arrow_store::DataStore,
}

impl Default for EntityDb {
Expand All @@ -34,7 +34,7 @@ impl Default for EntityDb {
entity_path_from_hash: Default::default(),
times_per_timeline: Default::default(),
tree: crate::EntityTree::root(),
arrow_store: re_arrow_store::DataStore::new(
data_store: re_arrow_store::DataStore::new(
InstanceKey::name(),
DataStoreConfig {
component_bucket_size_bytes: 1024 * 1024, // 1 MiB
Expand Down Expand Up @@ -87,22 +87,22 @@ impl EntityDb {
time_point.clone(),
vec![bundle],
);
self.arrow_store.insert(&msg_bundle).ok();
self.data_store.insert(&msg_bundle).ok();

// Also update the tree with the clear-event
self.tree.add_data_msg(&time_point, &component_path);
}
}

self.arrow_store.insert(&msg_bundle).map_err(Into::into)
self.data_store.insert(&msg_bundle).map_err(Into::into)
}

fn add_path_op(&mut self, msg_id: MsgId, time_point: &TimePoint, path_op: &PathOp) {
let cleared_paths = self.tree.add_path_op(msg_id, time_point, path_op);

for component_path in cleared_paths {
if let Some(data_type) = self
.arrow_store
.data_store
.lookup_data_type(&component_path.component_name)
{
// Create and insert an empty component into the arrow store
Expand All @@ -115,7 +115,7 @@ impl EntityDb {
time_point.clone(),
vec![bundle],
);
self.arrow_store.insert(&msg_bundle).ok();
self.data_store.insert(&msg_bundle).ok();
// Also update the tree with the clear-event
self.tree.add_data_msg(time_point, &component_path);
}
Expand All @@ -133,7 +133,7 @@ impl EntityDb {
entity_path_from_hash: _,
times_per_timeline,
tree,
arrow_store: _, // purged before this function is called
data_store: _, // purged before this function is called
} = self;

{
Expand Down Expand Up @@ -244,7 +244,7 @@ impl LogDb {
assert!((0.0..=1.0).contains(&fraction_to_purge));

let drop_msg_ids = {
let msg_id_chunks = self.entity_db.arrow_store.gc(
let msg_id_chunks = self.entity_db.data_store.gc(
GarbageCollectionTarget::DropAtLeastPercentage(fraction_to_purge as _),
Timeline::log_time(),
MsgId::name(),
Expand All @@ -259,7 +259,7 @@ impl LogDb {
.collect::<ahash::HashSet<_>>()
};

let cutoff_times = self.entity_db.arrow_store.oldest_time_per_timeline();
let cutoff_times = self.entity_db.data_store.oldest_time_per_timeline();

let Self {
chronological_message_ids,
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl eframe::App for App {
render_ctx.gpu_resources.statistics()
};

let store_stats = DataStoreStats::from_store(&self.log_db().entity_db.arrow_store);
let store_stats = DataStoreStats::from_store(&self.log_db().entity_db.data_store);

self.memory_panel.update(&gpu_resource_stats, &store_stats); // do first, before doing too many allocations

Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/misc/space_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ pub fn query_view_coordinates(
ent_path: &EntityPath,
query: &LatestAtQuery,
) -> Option<re_log_types::ViewCoordinates> {
let arrow_store = &entity_db.arrow_store;
let data_store = &entity_db.data_store;

let entity_view =
query_entity_with_primary::<ViewCoordinates>(arrow_store, query, ent_path, &[]).ok()?;
query_entity_with_primary::<ViewCoordinates>(data_store, query, ent_path, &[]).ok()?;

let mut iter = entity_view.iter_primary().ok()?;

Expand Down
14 changes: 7 additions & 7 deletions crates/re_viewer/src/ui/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,20 @@ impl AnnotationMap {
/// For each `EntityPath` in the `SceneQuery`, walk up the tree and find the nearest ancestor
///
/// An entity is considered its own (nearest) ancestor.
pub fn load(&mut self, ctx: &mut ViewerContext<'_>, query: &SceneQuery<'_>) {
pub fn load(&mut self, ctx: &mut ViewerContext<'_>, scene_query: &SceneQuery<'_>) {
crate::profile_function!();

let mut visited = IntSet::<EntityPath>::default();

let arrow_store = &ctx.log_db.entity_db.arrow_store;
let arrow_query = LatestAtQuery::new(query.timeline, query.latest_at);
let data_store = &ctx.log_db.entity_db.data_store;
let latest_at_query = LatestAtQuery::new(scene_query.timeline, scene_query.latest_at);

// This logic is borrowed from `iter_ancestor_meta_field`, but using the arrow-store instead
// not made generic as `AnnotationContext` was the only user of that function
for entity_path in query
for entity_path in scene_query
.entity_paths
.iter()
.filter(|entity_path| query.entity_props_map.get(entity_path).visible)
.filter(|entity_path| scene_query.entity_props_map.get(entity_path).visible)
{
let mut next_parent = Some(entity_path.clone());
while let Some(parent) = next_parent {
Expand All @@ -143,8 +143,8 @@ impl AnnotationMap {
// If we find one, insert it and then we can break.
std::collections::btree_map::Entry::Vacant(entry) => {
if query_entity_with_primary::<AnnotationContext>(
arrow_store,
&arrow_query,
data_store,
&latest_at_query,
&parent,
&[MsgId::name()],
)
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/data_ui/component_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl DataUi for ComponentPath {
verbosity: crate::ui::UiVerbosity,
query: &re_arrow_store::LatestAtQuery,
) {
let store = &ctx.log_db.entity_db.arrow_store;
let store = &ctx.log_db.entity_db.data_store;

match re_query::get_component_with_instances(
store,
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/data_ui/instance_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl DataUi for InstancePath {
verbosity: UiVerbosity,
query: &re_arrow_store::LatestAtQuery,
) {
let store = &ctx.log_db.entity_db.arrow_store;
let store = &ctx.log_db.entity_db.data_store;

let Some(mut components) = store.all_components(&query.timeline, &self.entity_path) else {
ui.label(format!("No components in entity {}", self.entity_path));
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_bar_chart/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl SceneBarChart {
fn load_tensors(&mut self, ctx: &mut ViewerContext<'_>, query: &SceneQuery<'_>) {
crate::profile_function!();

let store = &ctx.log_db.entity_db.arrow_store;
let store = &ctx.log_db.entity_db.data_store;

for (ent_path, props) in query.iter_entities() {
if !props.visible {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/ui/view_category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn categorize_entity_path(

for component in log_db
.entity_db
.arrow_store
.data_store
.all_components(&timeline, entity_path)
.unwrap_or_default()
{
Expand All @@ -108,7 +108,7 @@ pub fn categorize_entity_path(
let timeline_query = LatestAtQuery::new(timeline, TimeInt::MAX);

if let Ok(entity_view) = query_entity_with_primary::<Tensor>(
&log_db.entity_db.arrow_store,
&log_db.entity_db.data_store,
&timeline_query,
entity_path,
&[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl ScenePart for Arrows3DPart {
};

match query_primary_with_history::<Arrow3D, 5>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl ScenePart for Boxes2DPart {
let entity_highlight = highlights.entity_highlight(ent_path.hash());

match query_primary_with_history::<Rect2D, 6>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl ScenePart for Boxes3DPart {
let entity_highlight = highlights.entity_highlight(ent_path.hash());

match query_primary_with_history::<Box3D, 8>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl ScenePart for CamerasPart {
let query = re_arrow_store::LatestAtQuery::new(query.timeline, query.latest_at);

match query_entity_with_primary::<Transform>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query,
ent_path,
&[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl ScenePart for ImagesPart {
};

match query_primary_with_history::<Tensor, 3>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl ScenePart for Lines2DPart {
let entity_highlight = highlights.entity_highlight(ent_path.hash());

match query_primary_with_history::<LineStrip2D, 4>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl ScenePart for Lines3DPart {
let entity_highlight = highlights.entity_highlight(ent_path.hash());

match query_primary_with_history::<LineStrip3D, 4>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl ScenePart for MeshPart {
};

match query_primary_with_history::<Mesh3D, 3>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl ScenePart for Points2DPart {
let entity_highlight = highlights.entity_highlight(ent_path.hash());

match query_primary_with_history::<Point2D, 7>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl ScenePart for Points3DPart {
let entity_highlight = highlights.entity_highlight(ent_path.hash());

match query_primary_with_history::<Point3D, 7>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&query.timeline,
&query.latest_at,
&props.visible_history,
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_tensor/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl SceneTensor {
let timeline_query = LatestAtQuery::new(query.timeline, query.latest_at);

match query_entity_with_primary::<Tensor>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&timeline_query,
ent_path,
&[],
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_text/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl SceneText {
) {
crate::profile_function!();

let store = &ctx.log_db.entity_db.arrow_store;
let store = &ctx.log_db.entity_db.data_store;

for entity_path in query.entity_paths {
let ent_path = entity_path;
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_text/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn get_time_point(ctx: &ViewerContext<'_>, entry: &TextEntry) -> Option<TimePoin
if let Some(time_point) = ctx
.log_db
.entity_db
.arrow_store
.data_store
.get_msg_metadata(&entry.msg_id)
{
Some(time_point.clone())
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_time_series/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl SceneTimeSeries {
fn load_scalars(&mut self, ctx: &mut ViewerContext<'_>, query: &SceneQuery<'_>) {
crate::profile_function!();

let store = &ctx.log_db.entity_db.arrow_store;
let store = &ctx.log_db.entity_db.data_store;

for entity_path in query.entity_paths {
let ent_path = entity_path;
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/viewport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl Viewport {
.iter()
.filter_map(|entity_path| {
if let Ok(entity_view) = re_query::query_entity_with_primary::<Tensor>(
&ctx.log_db.entity_db.arrow_store,
&ctx.log_db.entity_db.data_store,
&timeline_query,
entity_path,
&[],
Expand Down