Skip to content

Commit

Permalink
define Catalog fields name in the protobuf spec crate and use them in…
Browse files Browse the repository at this point in the history
… the catalog view (#8710)

This fixes the broken catalog view, regression was caused by recent
renaming of fields on the SN side. Also there was 1 tiny change related
to arrow migration (representation of Timestamp array) that needed to be
changed as well.
  • Loading branch information
zehiko authored Jan 17, 2025
1 parent fdf065f commit 828e317
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
25 changes: 16 additions & 9 deletions crates/store/re_grpc_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ use re_protos::{
common::v0::RecordingId,
remote_store::v0::{
storage_node_client::StorageNodeClient, CatalogFilter, FetchRecordingRequest,
QueryCatalogRequest,
QueryCatalogRequest, CATALOG_APP_ID_FIELD_NAME, CATALOG_ID_FIELD_NAME,
CATALOG_START_TIME_FIELD_NAME,
},
};
use re_types::{
Expand Down Expand Up @@ -283,27 +284,33 @@ pub fn store_info_from_catalog_chunk(

let (_field, data) = tc
.components()
.find(|(f, _)| f.name() == "application_id")
.find(|(f, _)| f.name() == CATALOG_APP_ID_FIELD_NAME)
.ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed {
reason: "no application_id field found".to_owned(),
reason: "no {CATALOG_APP_ID_FIELD_NAME} field found".to_owned(),
}))?;
let app_id = data
.downcast_array_ref::<arrow::array::StringArray>()
.ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed {
reason: format!("application_id must be a utf8 array: {:?}", tc.schema_ref()),
reason: format!(
"{CATALOG_APP_ID_FIELD_NAME} must be a utf8 array: {:?}",
tc.schema_ref()
),
}))?
.value(0);

let (_field, data) = tc
.components()
.find(|(f, _)| f.name() == "start_time")
.find(|(f, _)| f.name() == CATALOG_START_TIME_FIELD_NAME)
.ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed {
reason: "no start_time field found".to_owned(),
reason: "no {CATALOG_START_TIME_FIELD_NAME}} field found".to_owned(),
}))?;
let start_time = data
.downcast_array_ref::<arrow::array::Int64Array>()
.downcast_array_ref::<arrow::array::TimestampNanosecondArray>()
.ok_or(StreamError::ChunkError(re_chunk::ChunkError::Malformed {
reason: format!("start_time must be an int64 array: {:?}", tc.schema_ref()),
reason: format!(
"{CATALOG_START_TIME_FIELD_NAME} must be a Timestamp array: {:?}",
tc.schema_ref()
),
}))?
.value(0);

Expand Down Expand Up @@ -485,7 +492,7 @@ async fn stream_catalog_async(
)))?;

let recording_uri_arrays: Vec<ArrowArrayRef> = chunk
.iter_slices::<String>("id".into())
.iter_slices::<String>(CATALOG_ID_FIELD_NAME.into())
.map(|id| {
let rec_id = &id[0]; // each component batch is of length 1 i.e. single 'id' value

Expand Down
12 changes: 12 additions & 0 deletions crates/store/re_protos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ pub mod log_msg {

/// Generated types for the remote store gRPC service API v0.
pub mod remote_store {

pub mod v0 {
pub use crate::v0::rerun_remote_store_v0::*;

/// Recording catalog mandatory field names. All mandatory metadata fields are prefixed
/// with "rerun_" to avoid conflicts with user-defined fields.
pub const CATALOG_ID_FIELD_NAME: &str = "rerun_recording_id";
pub const CATALOG_APP_ID_FIELD_NAME: &str = "rerun_application_id";
pub const CATALOG_START_TIME_FIELD_NAME: &str = "rerun_start_time";
pub const CATALOG_DESCRIPTION_FIELD_NAME: &str = "rerun_description";
pub const CATALOG_RECORDING_TYPE_FIELD_NAME: &str = "rerun_recording_type";
pub const CATALOG_STORAGE_URL_FIELD_NAME: &str = "rerun_storage_url";
pub const CATALOG_REGISTRATION_TIME_FIELD_NAME: &str = "rerun_registration_time";
pub const CATALOG_ROW_ID_FIELD_NAME: &str = "rerun_row_id";
}
}

Expand Down

0 comments on commit 828e317

Please sign in to comment.