Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion arrow-array/src/array/run_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl<R: RunEndIndexType> RunArray<R> {
}

// 2. run_ends must not contain null values.
if run_ends.nulls().is_some() {
if run_ends.null_count() != 0 {
return Err(ArrowError::InvalidArgumentError(
"Found null values in run_ends array. The run_ends array should not have null values."
.to_string(),
Expand Down Expand Up @@ -1248,6 +1248,18 @@ mod tests {
assert_eq!(expected.to_string(), actual.err().unwrap().to_string());
}

#[test]
fn test_run_array_run_ends_with_empty_null_buffer() {
let values = Int32Array::from(vec![7, 8]);
let run_ends = Int32Array::new(vec![2, 3].into(), Some(NullBuffer::new_valid(2)));

assert_eq!(run_ends.null_count(), 0);
assert!(run_ends.nulls().is_some());

let array = RunArray::<Int32Type>::try_new(&run_ends, &values).unwrap();
assert_eq!(array.len(), 3);
}

#[test]
fn test_run_array_run_ends_with_zeroes() {
let values: StringArray = [Some("foo"), Some("bar"), Some("baz")]
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ impl ArrayData {
run_ends_data.len, values_data.len
)));
}
if run_ends_data.nulls.is_some() {
if run_ends_data.null_count() != 0 {
return Err(ArrowError::InvalidArgumentError(
"Found null values in run_ends array. The run_ends array should not have null values.".to_string(),
));
Expand Down