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

Potential panic when writing invalid batch (nullability violated) #1936

Open
westonpace opened this issue Feb 9, 2024 · 0 comments · May be fixed by #2467
Open

Potential panic when writing invalid batch (nullability violated) #1936

westonpace opened this issue Feb 9, 2024 · 0 comments · May be fixed by #2467
Assignees
Labels
bug Something isn't working

Comments

@westonpace
Copy link
Contributor

It can sometimes be unfortunately easy to create arrays that contain null even when the field is marked non-nullable. An attempt to write one of these batches to lance will trigger a panic.

import pyarrow as pa
import lance

schema = pa.schema([pa.field("values", pa.utf8(), False)])
tab = pa.Table.from_pydict({"values": [None]}, schema=schema)
lance.write_dataset(tab, "/tmp/foo.dataset", mode='overwrite').to_table()

# thread '<unnamed>' panicked at /home/pace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-array-50.0.0/src/array/struct_array.rs:90:46:
# called `Result::unwrap()` on an `Err` value: InvalidArgumentError("Found unmasked nulls for non-nullable StructArray field \"min_value\"")
# note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
# Traceback (most recent call last):
#   File "/tmp/repr.py", line 6, in <module>
#     print(lance.write_dataset(tab, "/tmp/foo.dataset", mode='overwrite').to_table())
#           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#   File "/home/pace/dev/lance/python/python/lance/dataset.py", line 2347, in write_dataset
#     _write_dataset(reader, uri, params)
# pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: InvalidArgumentError("Found unmasked nulls for non-nullable StructArray field \"min_value\"")
@wjones127 wjones127 added the bug Something isn't working label Feb 9, 2024
@changhiskhan changhiskhan assigned westonpace and LiWeiJie and unassigned LiWeiJie Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants