Skip to content

TensorDataBatch doesn't support multiple tensors -> can't use it with send_columns #8361

@egorchakov

Description

@egorchakov

Describe the bug
Attempting to log a partition'd TensorDataBatch results in an error.

To Reproduce
Steps to reproduce the behavior:

# file: rerun_issue.py

import numpy as np
import rerun as rr

batch, dim = 10, 20

array = np.zeros((batch, dim))
indices = np.arange(batch)
lengths = np.array([dim] * batch)

rr.send_columns(
    "/entity",
    [rr.TimeSequenceColumn("indices", indices)],
    [rr.components.TensorDataBatch(array).partition(lengths)],
    strict=True,
)

Expected behavior
Logging succeeds.

Backtrace

uv run --isolated --with rerun-sdk==0.20.3 rerun_issue.py

Traceback (most recent call last):
  File "/Users/<user>/rerun_issue.py", line 11, in <module>
    rr.send_columns(
  File "/Users/<user>/Library/Caches/uv/archive-v0/cvPpsKaWxYZeojMA2lgt_/lib/python3.12/site-packages/rerun_sdk/rerun/error_utils.py", line 191, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<user>/Library/Caches/uv/archive-v0/cvPpsKaWxYZeojMA2lgt_/lib/python3.12/site-packages/rerun_sdk/rerun/_send_columns.py", line 234, in send_columns
    arrow_list_array = component_column.as_arrow_array()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<user>/Library/Caches/uv/archive-v0/cvPpsKaWxYZeojMA2lgt_/lib/python3.12/site-packages/rerun_sdk/rerun/_baseclasses.py", line 310, in as_arrow_array
    return pa.ListArray.from_arrays(offsets, array)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pyarrow/array.pxi", line 2557, in pyarrow.lib.ListArray.from_arrays
  File "pyarrow/array.pxi", line 1686, in pyarrow.lib.Array.validate
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Length spanned by list offsets (200) larger than values array (length 1)

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.4

Rerun version
rerun-cli 0.20.3 (default map_view nasm native_viewer release web_viewer) [rustc 1.79.0 (129f3b996 2024-06-10), LLVM 18.1.7] aarch64-apple-darwin release-0.20.3 7a031f3,
built 2024-12-03T17:44:19Z
Video features: av1 default ffmpeg nasm serde

Additional context
This issue doesn't occur for at least some other batch types (e.g. ScalarBatch), or without .partition(...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdk-pythonPython logging API🪳 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions