Skip to content

Commit 9f29bd0

Browse files
authored
Remove the check for WrongNumberOfInstances (#5399)
### What Also removed instances of the restriction in documentation. I believe, in theory this means we can remove a bunch of places where we determine and pass around num_instances. However, doing that requires cleaning up the splat-determination logic and the special splat-instance-key-value, which I assume will come as part of: - #5303 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5399/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5399/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5399/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5399) - [Docs preview](https://rerun.io/preview/140181bdafde95319a803565065aa3b5ed9efa63/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/140181bdafde95319a803565065aa3b5ed9efa63/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
1 parent a79bcf8 commit 9f29bd0

File tree

6 files changed

+1
-54
lines changed

6 files changed

+1
-54
lines changed

crates/re_log_types/src/data_row.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ use crate::{DataCell, DataCellError, DataTable, EntityPath, NumInstances, TableI
1111
/// An error that can occur because a row in the store has inconsistent columns.
1212
#[derive(thiserror::Error, Debug)]
1313
pub enum DataReadError {
14-
#[error(
15-
"Each cell must contain either 0, 1 or `num_instances` instances, \
16-
but cell '{component}' in '{entity_path}' holds {num_instances} instances \
17-
(expected {expected_num_instances})"
18-
)]
19-
WrongNumberOfInstances {
20-
entity_path: EntityPath,
21-
component: ComponentName,
22-
expected_num_instances: u32,
23-
num_instances: u32,
24-
},
25-
2614
#[error(
2715
"Same component type present multiple times within a single row: \
2816
'{component}' in '{entity_path}'"
@@ -389,19 +377,6 @@ impl DataRow {
389377
component,
390378
});
391379
}
392-
393-
match cell.num_instances() {
394-
0 | 1 => {}
395-
n if n == num_instances => {}
396-
n => {
397-
return Err(DataReadError::WrongNumberOfInstances {
398-
entity_path,
399-
component,
400-
expected_num_instances: num_instances,
401-
num_instances: n,
402-
})
403-
}
404-
}
405380
}
406381

407382
Ok(Self {

crates/re_sdk/src/recording_stream.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,6 @@ impl RecordingStream {
968968
/// See `RecordingStream::set_time_*` family of methods for more information.
969969
///
970970
/// The number of instances will be determined by the longest batch in the bundle.
971-
/// All of the batches should have the same number of instances, or length 1 if the component is
972-
/// a splat, or 0 if the component is being cleared.
973971
///
974972
/// The entity path can either be a string
975973
/// (with special characters escaped, split on unescaped slashes)

crates/re_types_core/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ pub trait AsComponents {
4949
///
5050
/// If not implemented, the number of instances will be determined by the longest
5151
/// batch in the bundle.
52-
///
53-
/// Each batch returned by `as_component_batches` should have this number of elements,
54-
/// or 1 in the case it is a splat, or 0 in the case that component is being cleared.
5552
#[inline]
5653
fn num_instances(&self) -> usize {
5754
self.as_component_batches()

rerun_cpp/src/rerun/recording_stream.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,6 @@ namespace rerun {
482482
/// This is a more low-level API than `log`/`log_timeless\ and requires you to already serialize the data
483483
/// ahead of time.
484484
///
485-
/// The number of instances in each batch must either be equal to the maximum or:
486-
/// - zero instances - implies a clear
487-
/// - single instance (but other instances have more) - causes a splat
488-
///
489485
/// \param entity_path Path to the entity in the space hierarchy.
490486
/// \param timeless If true, the logged components will be timeless.
491487
/// Otherwise, the data will be timestamped automatically with `log_time` and `log_tick`.

rerun_py/rerun_sdk/rerun/_baseclasses.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,10 @@ def as_component_batches(self) -> Iterable[ComponentBatchLike]:
4141
Returns an iterable of `ComponentBatchLike` objects.
4242
4343
Each object in the iterable must adhere to the `ComponentBatchLike`
44-
interface. All of the batches should have the same length as the value
45-
returned by `num_instances`, or length 1 if the component is a splat.,
46-
or 0 if the component is being cleared.
44+
interface.
4745
"""
4846
...
4947

50-
# def num_instances(self) -> int | None:
51-
# """
52-
# (Optional) The number of instances in each batch.
53-
#
54-
# If not implemented, the number of instances will be determined by the longest
55-
# batch in the bundle.
56-
#
57-
# Each batch returned by `as_component_batches` should have this number of
58-
# elements, or 1 in the case it is a splat, or 0 in the case that
59-
# component is being cleared.
60-
# """
61-
# return None
62-
6348

6449
@define
6550
class Archetype:

rerun_py/rerun_sdk/rerun/_log.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ def log_components(
186186
r"""
187187
Log an entity from a collection of `ComponentBatchLike` objects.
188188
189-
All of the batches should have the same length as the value of
190-
`num_instances`, or length 1 if the component is a splat., or 0 if the
191-
component is being cleared.
192-
193189
See also: [`rerun.log`][].
194190
195191
Parameters

0 commit comments

Comments
 (0)