-
Notifications
You must be signed in to change notification settings - Fork 839
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
FixedSizeBinaryArray::try_from_sparse_iter
failed when given all Nones
#1390
Comments
Thank you for the report @jamescorbett |
FixedSizeBinaryArray::try_from_sparse_iter
failed when given all Nones
Has it already been fixed? fn test_fixed_size_binary_array_from_sparse_iter() {
let none_option: Option<[u8; 32]> = None;
let input_arg = vec![none_option, none_option, none_option, none_option];
let arr =
FixedSizeBinaryArray::try_from_sparse_iter(input_arg.into_iter()).unwrap();
assert_eq!(0, arr.value_length());
assert_eq!(4, arr.len())
} I create and run this unit test, and it is ok. |
@jackwener one thing I noticed that that function isn't marked with #[test]
fn test_fixed_size_binary_array_from_sparse_iter() {
...
} Is there any chance you can put up a PR with the test? That way we can close this ticket -- as 'already fixed' if it passes |
The issue is not this. The error occurs when using the schema. |
I reproduce it successfully. Error case #[test]
fn test() {
let schema =
Schema::new(vec![Field::new("a", DataType::FixedSizeBinary(2), false)]);
let none_option: Option<[u8; 2]> = None;
let item = FixedSizeBinaryArray::try_from_sparse_iter(
vec![none_option, none_option, none_option].into_iter(),
)
.unwrap();
let rb = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(item)]).unwrap();
} correct example #[test]
fn test() {
let schema =
Schema::new(vec![Field::new("a", DataType::FixedSizeBinary(2), false)]);
let item = FixedSizeBinaryArray::try_from_sparse_iter(
vec![
None,
Some(vec![7, 8]),
Some(vec![9, 10]),
None,
Some(vec![13, 14]),
]
.into_iter(),
)
.unwrap();
let rb = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(item)]).unwrap();
} |
The essence of the problem is that we can't get the the type of |
Or the schema doesn't validate size for all none array |
Please reopen this issue. The pr does not fix the problem. See Jack's comment above for a test reproducing the issue |
Sorry @jamescorbett -- Github got overly excited and automatically closed the PR |
Here is a PR to add the test: #1551 |
Describe the bug
try_from_sparse_iter expects at least one item to have Some to determine the size. This is a bad assumption as it may recieve all Nones.
To Reproduce
Expected behavior
A record batch with a colum of all nulls.
Additional context
I would suggest fixing it by changing the behaviour of defaulting in array_binary.rs:560
or changing the schema validation to handle a 0 size if the array is empty.
The text was updated successfully, but these errors were encountered: