Skip to content

fix: Encoded an array of type Struct([]) #7419

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Weijun-H
Copy link
Member

@Weijun-H Weijun-H commented Apr 18, 2025

Which issue does this PR close?

Rationale for this change

Check the length of the rows when encoding the column

What changes are included in this PR?

Are there any user-facing changes?

No

@github-actions github-actions bot added the arrow Changes to the arrow crate label Apr 18, 2025
@Weijun-H Weijun-H changed the title fix: Encoded an array of type Struct([]) fix: Encoded an array of type Struct([]) Apr 18, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution @Weijun-H

true => (rows.row(idx), 0x01),
false => (*null, null_sentinel),
let (row, sentinel) = if array.is_valid(idx) {
let row = if rows.num_rows() == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried about adding a new test on each row of the conversion as that may slow down things significantly

I think we could check if the input array's size was greater than zero and just ignore the offsets if not

            let array = as_struct_array(column);
            if array.len() == 0 {
              return OK(())
            }

Or something

let back = converter.convert_rows(&r).unwrap();
assert_eq!(back.len(), 1);
assert_eq!(&back[0], &s);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also verify we have tests covering empty arrays of other offset based types (such as ListArray, StringArray, etc) ?

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

Successfully merging this pull request may close these issues.

RowConverter::convert_columns panics when encoding Struct([])
2 participants