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

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

Open
kawadakk opened this issue Feb 20, 2025 · 1 comment
Open

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

kawadakk opened this issue Feb 20, 2025 · 1 comment
Labels

Comments

@kawadakk
Copy link
Contributor

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

@kawadakk kawadakk added the bug label Feb 20, 2025
@tustvold
Copy link
Contributor

Following #4819 all dictionaries are expanded on encode, so I would expect convert_rows to product a List of Int32. This is very similar to #7169

Marking good first issue as this should be a straightforward change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants