Skip to content

Fix handling of components that only vary by descriptors#11593

Merged
Wumpf merged 31 commits intomainfrom
andreas/fix-handling-changing-descriptors
Oct 21, 2025
Merged

Fix handling of components that only vary by descriptors#11593
Wumpf merged 31 commits intomainfrom
andreas/fix-handling-changing-descriptors

Conversation

@Wumpf
Copy link
Member

@Wumpf Wumpf commented Oct 20, 2025

Related

What

... by biting the bullet and pretty much everything that so far indexes of ComponentDescriptor instead index over ComponentIdentifier.
I'd like to believe this also improves performance, but I haven't proven it.

There's a lot of access that goes descriptor_THING().component now which strongly implies that we should generate component_THING() instead. But I've left that as an exercise for the reader.

Commit by commit if you're into this thing - every successive commit is curated to walk up the stack of crates

TODO:

Needed follow-ups:

@Wumpf Wumpf added 🪳 bug Something isn't working 🚜 refactor Change the code, not the functionality include in changelog labels Oct 20, 2025
@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Web viewer built successfully.

Result Commit Link Manifest
f43c889 https://rerun.io/viewer/pr/11593 +nightly +main

View image diff on kitdiff.

Note: This comment is updated whenever you push a commit.

@Wumpf Wumpf force-pushed the andreas/fix-handling-changing-descriptors branch from 6bb4465 to d1fd07a Compare October 20, 2025 14:33
@Wumpf
Copy link
Member Author

Wumpf commented Oct 20, 2025

The repro case for the original example has become a bit more pathological. but it has handled correctly.

import rerun as rr

rr.init("duplicate_tagged_components", spawn=True)
# These are two groupings of content with a variety of fields but at least one intersects
schema = rr.DynamicArchetype("mcap.Schema")._with_descriptor_internal(
    rr.ComponentDescriptor("data", "mcap.Schema"), 1.0
)
image = rr.DynamicArchetype("SomeCustomImage")._with_descriptor_internal(
    rr.ComponentDescriptor("data", "SomeCustomImage"), 2.0
)
rr.log("/camera/data", schema)
rr.log("/camera/data", image)

The first descriptor wins - we viewer only shows/receives mcap.Schema.
No warning is logged right now which is a bit unfortunate. But given how hard it is to hit this now I'm ok with that.

@Wumpf Wumpf marked this pull request as ready for review October 20, 2025 14:44
@Wumpf Wumpf requested review from Copilot and grtlr October 20, 2025 15:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses handling of components that differ only by their descriptors by transitioning the codebase from indexing on ComponentDescriptor to indexing on ComponentIdentifier. The change affects query APIs, cache keys, storage structures, and UI components throughout the viewer and SDK codebases.

Key changes:

  • Query APIs now accept ComponentIdentifier instead of ComponentDescriptor for lookups
  • Internal storage structures index by ComponentIdentifier with descriptors stored as values
  • Cache keys updated to use ComponentIdentifier

Reviewed Changes

Copilot reviewed 152 out of 153 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rerun_py/src/arrow.rs Updates PendingRow component storage to use identifier-based indexing
examples/rust/extend_viewer_ui/src/main.rs Updates component UI queries to pass identifiers
examples/rust/custom_view/src/points3d_color_visualizer.rs Extracts component identifiers from descriptors for queries
Multiple descriptor snippet files Updates test code to use new component access patterns
Viewport/view blueprint files Converts descriptor-based lookups to identifier-based
Query cache and storage files Major refactoring of indexing from descriptors to identifiers
Comments suppressed due to low confidence (3)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@grtlr grtlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is already looking much nicer 🤩!

All of my comments are minor and only suggestions / notes to myself. Thank you for going through the effort of starting to make these changes.

pub fn new(timepoint: TimePoint, components: IntMap<ComponentDescriptor, ArrayRef>) -> Self {
pub fn new(
timepoint: TimePoint,
components: IntMap<ComponentIdentifier, (ComponentDescriptor, ArrayRef)>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I wonder if rustc will monomorphize the from_iter for IntMap into the same function as this (probably not).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so either. You're wondering whether the from_iter shortcut might be harmful?


let results =
cache.latest_at(&query, &descr.entity_path, [&component_descriptor]);
cache.latest_at(&query, &descr.entity_path, [descr.component]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deletion above is haunting me, but I guess that was just an early exit? Looking at the diff, we could have always just passed descr along.

Or did that line just become trivial because of @IsseW's recent refactor?

Copy link
Member Author

@Wumpf Wumpf Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe recently we had to add a brunch of descriptor lookups because of the chnage to component target, and those are gone now again because the descriptor is available in a more obvious fashion

don't see why it would be needed since we're asking the same store on the latest_at query then for the existance

}
}

// TODO(andreas): Remove this variant, we should let users construct `SerializedComponentColumn` directly to sharpen semantics.
Copy link
Member

@grtlr grtlr Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please (but not now, let's get this merged)!

@Wumpf Wumpf merged commit 781d526 into main Oct 21, 2025
43 of 46 checks passed
@Wumpf Wumpf deleted the andreas/fix-handling-changing-descriptors branch October 21, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪳 bug Something isn't working include in changelog 🚜 refactor Change the code, not the functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viewer queries incorrectly distinguishes by component metadata like archetype & field name rather than just component identifier

3 participants