Skip to content

Commit

Permalink
Remove check for inner nullability of component columns (#9009)
Browse files Browse the repository at this point in the history
### Related
* #8998
* #6819

### What
`pixi run rerun rerun://redap.rerun.io/catalog` failed with `Detected
malformed Chunk: The outer array in chunked component batch must be a
sparse list, got List(Field { name: "item", data_type: Utf8, nullable:
false, dict_id: 0, dict_is_ordered: false, metadata: {} })`.

The cause was a check in the `Chunk::sanity_check` requiring _inner
mutability_, i.e. allowing a single component to be null in a list. The
intention of the check was to check for _outer_ nullability, i.e. that
any cell in the column can be `null` (or a dense list).

In other words, we want to support `Vec<Option<Vec<T>>`, but NOT require
`Vec<Option<Vec<Option<T>>>`.

Why did this trigger now? Because we now allow sending component columns
as "mono components", i.e. as `Vec<T>` and that is then automatically
changed to `Vec<Vec<T>>`, but wether or not it has interior nullability
depends on if the source data had it.
  • Loading branch information
emilk authored Feb 12, 2025
1 parent 283043f commit c9d8dc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
19 changes: 7 additions & 12 deletions crates/store/re_chunk/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,24 +1521,19 @@ impl Chunk {
component_name.sanity_check();
for (component_desc, list_array) in per_desc {
component_desc.component_name.sanity_check();
if !matches!(list_array.data_type(), arrow::datatypes::DataType::List(_)) {
// Ensure that each cell is a list (we don't support mono-components yet).
if let arrow::datatypes::DataType::List(_field) = list_array.data_type() {
// We don't check `field.is_nullable()` here because we support both.
// TODO(#6819): Remove support for inner nullability.
} else {
return Err(ChunkError::Malformed {
reason: format!(
"The outer array in a chunked component batch must be a sparse list, got {:?}",
"The inner array in a chunked component batch must be a list, got {:?}",
list_array.data_type(),
),
});
}
if let arrow::datatypes::DataType::List(field) = list_array.data_type() {
if !field.is_nullable() {
return Err(ChunkError::Malformed {
reason: format!(
"The outer array in chunked component batch must be a sparse list, got {:?}",
list_array.data_type(),
),
});
}
}

if list_array.len() != row_ids.len() {
return Err(ChunkError::Malformed {
reason: format!(
Expand Down
4 changes: 2 additions & 2 deletions crates/store/re_grpc_client/src/redap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ pub fn stream_from_redap(
recording_id,
} => {
if let Err(err) = stream_recording_async(tx, origin, recording_id, on_msg).await {
re_log::warn!(
re_log::error!(
"Error while streaming {url}: {}",
re_error::format_ref(&err)
);
}
}
RedapAddress::Catalog { origin } => {
if let Err(err) = stream_catalog_async(tx, origin, on_msg).await {
re_log::warn!(
re_log::error!(
"Error while streaming {url}: {}",
re_error::format_ref(&err)
);
Expand Down

0 comments on commit c9d8dc6

Please sign in to comment.