You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Sliced arrays lead to incorrect null buffers. I have found this in code where I copied the null buffer of one array to that of a new one (without offset).
I could pinpoint this bug in the take kernel, but I think it may occur in other parts as well.
In the code snippet below, you see the output of the array having two zero values where that should be null. As these are the values that should not have their validity bits set, it could probably be any other value at runtime.
I could also reproduce this with other StringArray
@jhorstmann Should there be done some arithmetic to compute the offset of the slice. Eg. bytes to bits. And what if the offset of the indices is not a multiple of 8? Should we then copy the right bits to a new buffer?
@ritchie46 there is a bit_slice method in Buffer for this usecase, if the offset is a multiple of 8 it returns a shallow slice, otherwise a new buffer with the shifted bits is constructed. And I agree this api is really easy to miss or error prone to use and we need to somehow come up with an api that doesn't require us to constantly think about bit offsets.
Describe the bug
Sliced arrays lead to incorrect null buffers. I have found this in code where I copied the
null
buffer of one array to that of a new one (without offset).I could pinpoint this bug in the
take
kernel, but I think it may occur in other parts as well.In the code snippet below, you see the output of the array having two zero values where that should be null. As these are the values that should not have their validity bits set, it could probably be any other value at runtime.
I could also reproduce this with other StringArray
To Reproduce
Output
Expected behavior
I'd expect the sliced array to have the same result as the array that is not sliced.
Additional context
pola-rs/polars#878
The text was updated successfully, but these errors were encountered: