-
Notifications
You must be signed in to change notification settings - Fork 483
Add DataFusionTableWidget::column_visibility
and use it to improve visibility defaults for the partition table
#9936
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
Changes from all commits
3d45e63
2bdcda1
5f500eb
19d73de
4ac93d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ use std::sync::mpsc::{Receiver, Sender}; | |
|
||
use egui::{Frame, Margin, RichText}; | ||
|
||
use re_log_types::EntryId; | ||
use re_protos::manifest_registry::v1alpha1::DATASET_MANIFEST_ID_FIELD_NAME; | ||
use re_log_types::{EntityPathPart, EntryId}; | ||
use re_protos::manifest_registry::v1alpha1::{ | ||
DATASET_MANIFEST_ID_FIELD_NAME, DATASET_MANIFEST_REGISTRATION_TIME_FIELD_NAME, | ||
}; | ||
use re_ui::list_item::ItemActionButton; | ||
use re_ui::{UiExt as _, icons, list_item}; | ||
use re_viewer_context::{ | ||
|
@@ -115,6 +117,8 @@ impl Server { | |
ui: &mut egui::Ui, | ||
dataset: &Dataset, | ||
) { | ||
const RECORDING_LINK_FIELD_NAME: &str = "recording link"; | ||
|
||
re_dataframe_ui::DataFusionTableWidget::new( | ||
self.tables_session_ctx.ctx.clone(), | ||
dataset.name(), | ||
|
@@ -125,16 +129,30 @@ impl Server { | |
.send(Command::RefreshCollection(self.origin.clone())) | ||
.ok(); | ||
})) | ||
.column_renamer(|desc| { | ||
.column_name(|desc| { | ||
//TODO(ab): with this strategy, we do not display relevant entity path if any. | ||
let name = desc.short_name(); | ||
|
||
name.strip_prefix("rerun_") | ||
.unwrap_or(name) | ||
.replace('_', " ") | ||
}) | ||
.default_column_visibility(|desc| { | ||
if desc.entity_path().is_some_and(|entity_path| { | ||
entity_path.starts_with(&std::iter::once(EntityPathPart::properties()).collect()) | ||
}) { | ||
true | ||
} else { | ||
matches!( | ||
desc.short_name(), | ||
RECORDING_LINK_FIELD_NAME | ||
| DATASET_MANIFEST_ID_FIELD_NAME | ||
| DATASET_MANIFEST_REGISTRATION_TIME_FIELD_NAME | ||
) | ||
abey79 marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+147
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matching on string here is extremely brittle and is already causing problems with #9983 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, that's a strange comment to make tbh. This code uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But does it make sense for this code to break when we change how columns are displayed (e.g. when we change the implementation of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These columns don't have much metadata—basically just a raw record batch built ad hoc on the server. Specifically, they don't have an archetype. Again, we need a much strong system to relate record batch/dataframe column name with column descriptors, which must account for arbitrary tables sent by the server and/or users. ![]() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For component column, it corresponds to |
||
} | ||
}) | ||
.generate_partition_links( | ||
"recording link", | ||
RECORDING_LINK_FIELD_NAME, | ||
DATASET_MANIFEST_ID_FIELD_NAME, | ||
self.origin.clone(), | ||
dataset.id(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this hard-coded string? Where does it come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a column that is live injected using datafusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it live-injected? Who gives it this name? What other piece of code needs to be updated in tandem with this piece of code?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the location of this const suggests, this is all local to this method.
generate_partition_links
is what triggers that column generation (it takes a column name as input), anddefault_column_visibility
defines, well, what the columns are visible by default (and it wants that generated column to be visible by default).