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

Fix panic when hashing empty FixedSizeList Array #13533

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

findepi
Copy link
Member

@findepi findepi commented Nov 22, 2024

Previously it would panic due to division by zero.

@github-actions github-actions bot added the common Related to common crate label Nov 22, 2024
Previously it would panic due to division by zero.
@findepi findepi force-pushed the findepi/fix-panic-when-hashing-empty-fixedsizelist-array-ff5e68 branch from 3ea432f to 28e3b99 Compare November 22, 2024 21:42
Comment on lines 325 to 329
let offset_size = if array.len() == 0 {
0
} else {
value_len as usize / array.len()
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Would this be equiv to array.value_length()?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think value_length is different

Like a FixedSlizeLIst(3) would have elements that are each 3 bytes, but the array can have any number of elements (rows)

So in that case value_length() is 3

Copy link
Member Author

Choose a reason for hiding this comment

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

in this example, value_length() is 3
array.len() is something, say N
so i though that value_len is 3 * N

ie. i kind of suspect this division is calculating what is know from the array type (the 3 in the example)

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 https://docs.rs/arrow/latest/arrow/array/struct.FixedSizeBinaryArray.html#method.value_length

I don't understand what this offset_size is really used for to be honest -- it doesn't make a lot of sense below either

It seems the intention is more like offset_size = array.value_length() 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems the intention is more like offset_size = array.value_length() 🤔

that's my take too

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.

Looks good to me -- thank you @findepi

Comment on lines 325 to 329
let offset_size = if array.len() == 0 {
0
} else {
value_len as usize / array.len()
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think value_length is different

Like a FixedSlizeLIst(3) would have elements that are each 3 bytes, but the array can have any number of elements (rows)

So in that case value_length() is 3

@findepi findepi force-pushed the findepi/fix-panic-when-hashing-empty-fixedsizelist-array-ff5e68 branch from 69136a2 to 4b46b8a Compare November 23, 2024 18:00
@findepi findepi requested a review from alamb November 23, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Related to common crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants