Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

grtlr
Copy link
Member

@grtlr grtlr commented Aug 4, 2025

Related

What

Important

Admittedly, the way this code is called is still a mess. My next steps will be cleaning up the general MCAP data loader architecture, but I wanted to get the protobuf decoding out separately.

This PR implements low-level Arrow conversion of protobuf-encoded MCAP messages using runtime reflection from the prost_reflect crate. Given a protobuf-based MCAP schema a dynamic set of Arrow builders is created. Each message is then encoded recursively using these builders.

This PR also contains a drive-by fix for a missing field in PointCloud2, happy to pull that out if requested!

Todos

There is some performance concern with the current implentation, namely that we re-decode the schema once for every MCAP chunk. That will require re-architecting some of the higher-level code, which I will be doing in a separate PR.

Copy link

github-actions bot commented Aug 4, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
9f59cf6 https://rerun.io/viewer/pr/10791 +nightly +main

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

@grtlr grtlr force-pushed the grtlr/mcap-cont branch from 65ad556 to f6fea83 Compare August 4, 2025 14:30
@grtlr grtlr added 📺 re_viewer affects re_viewer itself include in changelog 🧢 MCAP Everything related to the MCAP support labels Aug 4, 2025
stash more

reverted

builders are broken

savegame

autosave

boxed all the way

even closer

should work?

stash

even closer

holy!

Implement hard coded JSON loading

Protobuf improvements

Remove `jsonschema` again for now
@grtlr grtlr force-pushed the grtlr/mcap-cont branch from f6fea83 to 3ac3d1d Compare August 5, 2025 17:37
@grtlr grtlr marked this pull request as ready for review August 6, 2025 08:26
@jleibs jleibs self-requested a review August 6, 2025 11:20
Copy link
Member

@jleibs jleibs left a comment

Choose a reason for hiding this comment

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

Nice! This is quite elegant.

.with_field("id", Arc::new(UInt16Array::from(vec![*id])))
.with_field("name", Arc::new(StringArray::from(vec![name.clone()])))
.with_component::<components::Blob>("data", vec![blob])
.with_field("data", Arc::new(BinaryArray::from(vec![data.as_ref()])))
Copy link
Member

Choose a reason for hiding this comment

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

While I'm happy that we're storing this, the fact that it lives in separate static component is kind of annoying for some practical use-cases since it means the schema and the binary payloads will live in separate chunks that need to be tracked together.

I'm wondering if it's worth actually adding this schema-data to the Field-metadata associate with the "Binary Message Payload" column itself (if and when we create it). This would make that column totally self-describing and able to be decoded viewer-side using the same reflection techniques you've implemented here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that makes sense! From a viewer perspective adding this as a static chunk makes sense though, so I could see us supporting both ways going forward.

Not sure if Arrow field metadata is the right place though, or if this will end up in the promised out-of-band metadata (cc @teh-cmc).

@grtlr grtlr merged commit 15f1209 into main Aug 7, 2025
40 checks passed
@grtlr grtlr deleted the grtlr/mcap-cont branch August 7, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include in changelog 🧢 MCAP Everything related to the MCAP support 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants