Skip to content

RowConverter::convert_columns panics when encoding Struct([]) #7168

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

Open
kawadakk opened this issue Feb 21, 2025 · 0 comments · May be fixed by #7419
Open

RowConverter::convert_columns panics when encoding Struct([]) #7168

kawadakk opened this issue Feb 21, 2025 · 0 comments · May be fixed by #7419
Labels

Comments

@kawadakk
Copy link
Contributor

Describe the bug
RowConverter::convert_columns panics when encoding an array of type Struct([]).

To Reproduce

#[test]
fn test_unit_struct() {
    let s = Arc::new(StructArray::new_empty_fields(5, None)) as ArrayRef;

    let sort_fields = vec![SortField::new(s.data_type().clone())];
    let converter = RowConverter::new(sort_fields).unwrap();
    let r = converter.convert_columns(&[Arc::clone(&s)]).unwrap();

    let back = converter.convert_rows(&r).unwrap();
    assert_eq!(back.len(), 1);
    assert_eq!(&back[0], &s);
}
thread 'tests::test_unit_struct' panicked at arrow-row/src/lib.rs:881:9:
assertion failed: row + 1 < self.offsets.len()

Expected behavior
Not panicking

Additional context

@kawadakk kawadakk added the bug label Feb 21, 2025
@Weijun-H Weijun-H linked a pull request Apr 18, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant