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

FixedSizeBinaryArray::try_from_sparse_iter failed when given all Nones #1508

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions arrow/src/array/array_binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,18 @@ impl FixedSizeBinaryArray {
/// # Errors
///
/// Returns error if argument has length zero, or sizes of nested slices don't match.
pub fn try_from_sparse_iter<T, U>(mut iter: T) -> Result<Self>
pub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self>
where
T: Iterator<Item = Option<U>>,
U: AsRef<[u8]>,
{
Self::try_from_sparse_iter_sized(iter, 0)
}

pub fn try_from_sparse_iter_sized<T, U>(
mut iter: T,
default_size: usize,
) -> Result<Self>
where
T: Iterator<Item = Option<U>>,
U: AsRef<[u8]>,
Expand Down Expand Up @@ -583,7 +594,7 @@ impl FixedSizeBinaryArray {
));
}

let size = size.unwrap_or(0);
let size = size.unwrap_or(default_size);
let array_data = unsafe {
ArrayData::new_unchecked(
DataType::FixedSizeBinary(size as i32),
Expand Down