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

Remove the check for WrongNumberOfInstances #5399

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions crates/re_log_types/src/data_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ use crate::{DataCell, DataCellError, DataTable, EntityPath, NumInstances, TableI
/// An error that can occur because a row in the store has inconsistent columns.
#[derive(thiserror::Error, Debug)]
pub enum DataReadError {
#[error(
"Each cell must contain either 0, 1 or `num_instances` instances, \
but cell '{component}' in '{entity_path}' holds {num_instances} instances \
(expected {expected_num_instances})"
)]
WrongNumberOfInstances {
entity_path: EntityPath,
component: ComponentName,
expected_num_instances: u32,
num_instances: u32,
},

#[error(
"Same component type present multiple times within a single row: \
'{component}' in '{entity_path}'"
Expand Down Expand Up @@ -389,19 +377,6 @@ impl DataRow {
component,
});
}

match cell.num_instances() {
0 | 1 => {}
n if n == num_instances => {}
n => {
return Err(DataReadError::WrongNumberOfInstances {
entity_path,
component,
expected_num_instances: num_instances,
num_instances: n,
})
}
}
}

Ok(Self {
Expand Down
2 changes: 0 additions & 2 deletions crates/re_sdk/src/recording_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,6 @@ impl RecordingStream {
/// See `RecordingStream::set_time_*` family of methods for more information.
///
/// The number of instances will be determined by the longest batch in the bundle.
/// All of the batches should have the same number of instances, or length 1 if the component is
/// a splat, or 0 if the component is being cleared.
///
/// The entity path can either be a string
/// (with special characters escaped, split on unescaped slashes)
Expand Down
3 changes: 0 additions & 3 deletions crates/re_types_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ pub trait AsComponents {
///
/// If not implemented, the number of instances will be determined by the longest
/// batch in the bundle.
///
/// Each batch returned by `as_component_batches` should have this number of elements,
/// or 1 in the case it is a splat, or 0 in the case that component is being cleared.
#[inline]
fn num_instances(&self) -> usize {
self.as_component_batches()
Expand Down
4 changes: 0 additions & 4 deletions rerun_cpp/src/rerun/recording_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,6 @@ namespace rerun {
/// This is a more low-level API than `log`/`log_timeless\ and requires you to already serialize the data
/// ahead of time.
///
/// The number of instances in each batch must either be equal to the maximum or:
/// - zero instances - implies a clear
/// - single instance (but other instances have more) - causes a splat
///
/// \param entity_path Path to the entity in the space hierarchy.
/// \param timeless If true, the logged components will be timeless.
/// Otherwise, the data will be timestamped automatically with `log_time` and `log_tick`.
Expand Down
17 changes: 1 addition & 16 deletions rerun_py/rerun_sdk/rerun/_baseclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,10 @@ def as_component_batches(self) -> Iterable[ComponentBatchLike]:
Returns an iterable of `ComponentBatchLike` objects.

Each object in the iterable must adhere to the `ComponentBatchLike`
interface. All of the batches should have the same length as the value
returned by `num_instances`, or length 1 if the component is a splat.,
or 0 if the component is being cleared.
interface.
"""
...

# def num_instances(self) -> int | None:
# """
# (Optional) The number of instances in each batch.
#
# If not implemented, the number of instances will be determined by the longest
# batch in the bundle.
#
# Each batch returned by `as_component_batches` should have this number of
# elements, or 1 in the case it is a splat, or 0 in the case that
# component is being cleared.
# """
# return None


@define
class Archetype:
Expand Down
4 changes: 0 additions & 4 deletions rerun_py/rerun_sdk/rerun/_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ def log_components(
r"""
Log an entity from a collection of `ComponentBatchLike` objects.

All of the batches should have the same length as the value of
`num_instances`, or length 1 if the component is a splat., or 0 if the
component is being cleared.

See also: [`rerun.log`][].

Parameters
Expand Down
Loading