Skip to content

RowConverter::convert_rows panics when decoding List(Dictionary) #7165

@kawadakk

Description

@kawadakk

Describe the bug
RowConverter::convert_rows panics when decoding rows of type List(Dictionary(Int32, Int32)).

To Reproduce

#[test]
fn test_list_of_primitive_dictionary() {
    let mut builder =
        ListBuilder::<PrimitiveDictionaryBuilder<Int32Type, Int32Type>>::default();
    builder.values().append(2).unwrap();
    builder.values().append(3).unwrap();
    builder.values().append(0).unwrap();
    builder.values().append_null();
    builder.values().append(5).unwrap();
    builder.values().append(3).unwrap();
    builder.values().append(-1).unwrap();
    builder.append(true);

    let a = Arc::new(builder.finish()) as ArrayRef;
    let data_type = a.data_type().clone();

    let field = SortField::new(data_type.clone());
    let converter = RowConverter::new(vec![field]).unwrap();
    let rows = converter.convert_columns(&[Arc::clone(&a)]).unwrap();

    let back = converter.convert_rows(&rows).unwrap();
    assert_eq!(back.len(), 1);
    back[0].to_data().validate_full().unwrap();
    assert_eq!(&back[0], &a);
}
thread 'tests::test_list_of_primitive_dictionary' panicked at arrow-array/src/array/list_array.rs:429:14:
Expected infallible creation of GenericListArray from ArrayDataRef failed: InvalidArgumentError("[Large]ListArray's child datatype Int32 does not correspond to the List's datatype Dictionary(Int32, Int32)")

Expected behavior
Not panicking

Additional context

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions