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

Add ComponentDescriptorRef to re_sorbet #9043

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

abey79
Copy link
Member

@abey79 abey79 commented Feb 14, 2025

Related

What

This PR introduce the ComponentDescriptorRef type to re_sorbet. It's like ComponentDescriptor but:

  • It has refs instead of owned copies.
  • It has a RowId enum (which would be difficult to add to ComponentDescriptor because of the ramifications on the dataframe API—let's wait for the RowID <-> Index column merge for that).

Copy link

github-actions bot commented Feb 14, 2025

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

  • I have tested the web viewer
Result Commit Link Manifest
0d3c3f3 https://rerun.io/viewer/pr/9043 +nightly +main

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

@abey79 abey79 added exclude from changelog PRs with this won't show up in CHANGELOG.md 🔩 data model Sorbet labels Feb 14, 2025
@abey79 abey79 marked this pull request as ready for review February 14, 2025 14:29
Comment on lines 16 to 35
impl ColumnDescriptorRef<'_> {
#[inline]
pub fn entity_path(&self) -> Option<&EntityPath> {
match self {
Self::RowId(_) | Self::Time(_) => None,
Self::Component(descr) => Some(&descr.entity_path),
}
}

#[inline]
pub fn short_name(&self) -> String {
match self {
Self::RowId(descr) => descr.name().to_owned(),
Self::Time(descr) => descr.timeline.name().to_string(),
Self::Component(descr) => descr.component_name.short_name().to_owned(),
}
}

#[inline]
pub fn is_static(&self) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

I know the existing ColumnDescriptor already had these functions, and that they are undocumented. But do we really need them? I prefer to remove them, as I find it hard to explain why the row-id column is not static, for instance.

If we do want them, then let us add docstrings for why their indended use is

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll remove all the ones I dont need (which is all but short_name)

@@ -34,6 +34,12 @@ impl RowIdColumnDescriptor {
Self {}
}

#[inline]
#[expect(clippy::unused_self)]
pub fn name(&self) -> &'static str {
Copy link
Member

Choose a reason for hiding this comment

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

What is the intentional use for this? If this is supposed to be the default column name, then I think we should use either PascalCase or snake_case. If this is supposed to be a human readable string, then I think "Row ID" is better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Human readable name, so "Row ID" it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔩 data model Sorbet exclude from changelog PRs with this won't show up in CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants