Skip to content

Commit

Permalink
Failing test to reproduce bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberkilo committed Dec 20, 2021
1 parent fc343e7 commit cf7bd4f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions parquet/src/arrow/arrow_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,38 @@ mod tests {
one_column_roundtrip("list_single_column", values, true, Some(SMALL_SIZE / 2));
}

#[test]
fn null_list_single_column() {
let null_field = Field::new("item", DataType::Null, true);
let list_field = Field::new(
"emptylist",
DataType::List(Box::new(null_field)),
true,
);

let schema = Schema::new(vec![list_field]);

// Build a ListArray[NullArray(0)]

let a_values = NullArray::new(0);
let a_value_offsets =
arrow::buffer::Buffer::from(&[0, 0].to_byte_slice());
let a_list_data = ArrayData::builder(DataType::List(Box::new(Field::new(
"item",
DataType::Null, true
))))
.len(1)
.add_buffer(a_value_offsets)
.null_bit_buffer(Buffer::from(vec![0b00011011]))
.add_child_data(a_values.data().clone())
.build()
.unwrap();

let a = ListArray::from(a_list_data);
let batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(a)]).unwrap();
roundtrip("test_null_list_single_column.parquet", batch, None);
}

#[test]
fn large_list_single_column() {
let a_values = Int32Array::from(vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
Expand Down

0 comments on commit cf7bd4f

Please sign in to comment.