Skip to content

Commit

Permalink
Fix broken querying logic with the dataframe view in time range mode (#…
Browse files Browse the repository at this point in the history
…7159)

### What

This PR fixes the querying logic of the time range dataframe view. It
was broken and gave results such as these:

![image
(4)](https://github.com/user-attachments/assets/13946355-ce0d-4590-befe-aa739e2bcbfa)

<br/><br/>
(note the missing position and color data)

Now: 

<img width="772" alt="image"
src="https://github.com/user-attachments/assets/a14df713-828b-4ce0-bfa1-d757722741ae">


### 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/7159?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/7159?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/7159)
- [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`.
  • Loading branch information
abey79 authored Aug 13, 2024
1 parent 103e5a1 commit e8ae7fe
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions crates/viewer/re_space_view_dataframe/src/time_range_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use re_data_ui::item_ui::entity_path_button;
use re_entity_db::InstancePath;
use re_log_types::{EntityPath, ResolvedTimeRange, TimeInt, Timeline};
use re_types::blueprint::components::{SortKey, SortOrder};
use re_types_core::ComponentName;
use re_viewer_context::{Item, UiLayout, ViewQuery, ViewerContext};

use crate::table_ui::{row_id_ui, table_ui};
Expand Down Expand Up @@ -87,24 +86,20 @@ pub(crate) fn time_range_table_ui(
}

#[inline]
fn entity_components_to_key_value_iter<'a>(
fn entity_to_key_value_iter<'a>(
ctx: &ViewerContext<'_>,
entity_path: &'a EntityPath,
component: &'a ComponentName,
timeline: Timeline,
resolved_time_range: ResolvedTimeRange,
) -> impl Iterator<Item = (RowKey, Arc<Chunk>)> + 'a {
let range_query = RangeQuery::new(timeline, resolved_time_range);

ctx.recording_store()
.range_relevant_chunks(&range_query, entity_path, *component)
.range_relevant_chunks_for_all_components(&range_query, entity_path)
.into_iter()
// Exploit the fact that the returned iterator (if any) is *not* bound to the lifetime
// of the chunk (it has an internal Arc).
.map(move |chunk| {
let chunk = Arc::new(chunk.range(&range_query, *component));
(Arc::clone(&chunk).iter_indices_owned(&timeline), chunk)
})
.map(move |chunk| (Arc::clone(&chunk).iter_indices_owned(&timeline), chunk))
.flat_map(move |(indices_iter, chunk)| {
map_chunk_indices_to_key_value_iter(
indices_iter,
Expand All @@ -120,15 +115,12 @@ pub(crate) fn time_range_table_ui(
.iter_all_data_results()
.filter(|data_result| data_result.is_visible(ctx))
.flat_map(|data_result| {
sorted_components.iter().flat_map(move |component| {
entity_components_to_key_value_iter(
ctx,
&data_result.entity_path,
component,
*timeline,
resolved_time_range,
)
})
entity_to_key_value_iter(
ctx,
&data_result.entity_path,
*timeline,
resolved_time_range,
)
})
.collect::<BTreeMap<_, _>>();

Expand Down

0 comments on commit e8ae7fe

Please sign in to comment.