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

Introduce ColumnSelector instead of ColumnDescriptor #7444

Merged
merged 8 commits into from
Sep 19, 2024

Conversation

jleibs
Copy link
Member

@jleibs jleibs commented Sep 18, 2024

What

Resolves:

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

To run all checks from main, comment on the PR with @rerun-bot full-check.

@jleibs jleibs added ⛃ re_datastore affects the datastore itself exclude from changelog PRs with this won't show up in CHANGELOG.md labels Sep 18, 2024
@jleibs jleibs marked this pull request as ready for review September 18, 2024 21:42
Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

I like this new API, it fits the dataframe view well. And I can see a path to have the future ArchetypeSelector usable there as well.

crates/store/re_chunk_store/src/dataframe.rs Show resolved Hide resolved
Comment on lines 450 to 456
impl From<ControlColumnDescriptor> for ControlColumnSelector {
fn from(desc: ControlColumnDescriptor) -> Self {
Self {
component: desc.component_name,
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

A helper for the row id column would be neat 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.

Ha, yeah, I did exactly that in the python APIs.

Comment on lines +502 to +508
pub fn new<C: re_types_core::Component>(entity_path: EntityPath) -> Self {
Self {
entity_path,
component: C::name(),
join_encoding: JoinEncoding::default(),
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: from my perspective, this is a bit too restrictive an API to deserve the privileged new() name. Oftentimes, I just have a component name (e.g. when deserialising from blueprint).

Suggested change
pub fn new<C: re_types_core::Component>(entity_path: EntityPath) -> Self {
Self {
entity_path,
component: C::name(),
join_encoding: JoinEncoding::default(),
}
}
pub fn new(entity_path: EntityPath, component: ComponentName) -> Self {
Self {
entity_path,
component,
join_encoding: JoinEncoding::default(),
}
}
pub fn new_for_component<C: re_types_core::Component>(entity_path: EntityPath) -> Self {
Self::new(entity_path, C::name())
}

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 think you are practically speaking in the minority of users that would feel restricted here. I think having concrete components is likely to be the more common pattern than dealing with raw ComponentNames.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough.

archetype_name: None,
archetype_field_name: None,
component_name: selector.component,
store_datatype: ArrowListArray::<i32>::default_datatype(datatype.clone()),
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't that depend on selector.join_encoding?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope. The store_datatype is always a list. join_encoding influences the construction of .returned_datatype()

@jleibs jleibs merged commit 81d3e0b into main Sep 19, 2024
33 checks passed
@jleibs jleibs deleted the jleibs/column_selectors branch September 19, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md ⛃ re_datastore affects the datastore itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants