lance-format / lance-format/lance
dataset.to_table().to_pandas() raise error `Io error: Execution error: LanceError(Arrow): Invalid argument error`
Open
Nobody has claimed this yet.
arrow
enhancement
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
example code
import lance
import pyarrow as pa
import numpy as np
train_data_size = 100000
test_data_size = 100
vector_dimension = 768
cluster_number = 10
cluster_size = train_data_size // cluster_number
train_data = []
for i in range(cluster_number):
cluster_center = np.random.rand(vector_dimension)
cluster_data = np.random.randn(cluster_size, vector_dimension) + cluster_center
train_data.append(cluster_data)
# save train data to parquet file
train_data = np.concatenate(train_data)
train_data = np.array(train_data, dtype=np.float32)
table = pa.table({
"id": pa.array([x for x in range(train_data_size)]),
"embedding": pa.array(train_data.tolist())
})
dataset = lance.write_dataset(table, "embeddings")
df = dataset.to_table().to_pandas()
print(df.head())
error
Traceback (most recent call last):
xxx
File "pyarrow/ipc.pxi", line 750, in pyarrow.lib.RecordBatchReader.read_all
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: C Data interface error: Io error: Execution error: LanceError(Arrow): Invalid argument error: Last offset 6290688 of List(Field { name: "item", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }) is larger than values length 8192
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the provided Python reproduction with the listed dependencies, then trace dataset.to_table().to_pandas() through the Arrow C Data interface shown in the traceback. Done means the example completes and prints the DataFrame without the List offset/values-length ArrowInvalid error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- data, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100