Skip to content

Zero dimension vectors cause Lance to panic #5102

@wjones127

Description

@wjones127

Not that this is useful, but it should return an error instead of panicking.

import pyarrow as pa
import lance
schema = pa.schema([
    pa.field("id", pa.int64()),
    pa.field("vec", pa.list_(pa.float32(), 0)),  # Fixed size = 0
])
data = pa.table({
    "id": [1, 2, 3],
    "vec": [[], [], []],  # Empty arrays matching the 0 dimension
}, schema=schema)

ds = lance.write_dataset(data, "memory://")
ds.to_table()
thread 'lance_background_thread' panicked at /home/will/Documents/lance/rust/lance-encoding/src/data.rs:403:9:
attempt to divide by zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'lance_background_thread' panicked at /home/will/Documents/lance/rust/lance-table/src/utils/stream.rs:390:46:
called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(46), "attempt to divide by zero", ...)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/will/Documents/lance/python/python/lance/dataset.py", line 1073, in to_table
    ).to_table()
  File "/home/will/Documents/lance/python/python/lance/dataset.py", line 4631, in to_table
    return self.to_reader().read_all()
  File "pyarrow/ipc.pxi", line 762, in pyarrow.lib.RecordBatchReader.read_all
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: External error: RuntimeError: Task was aborted

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions