Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

panic when comparing arrays where one of them has a validity bitmap + offset #551

Closed
ritchie46 opened this issue Oct 26, 2021 · 1 comment
Labels
bug Something isn't working no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog

Comments

@ritchie46
Copy link
Collaborator

Since #540 the following code panics.

use arrow::array::*;
use arrow::datatypes::{DataType, Field};
use arrow::bitmap::Bitmap;
use std::iter::FromIterator;
use std::sync::Arc;
use arrow::compute::comparison::{compare, Operator};

fn main() {
    // create a list-array
    let offsets = vec![0, 2, 3];
    let validity = Bitmap::from_iter([true, true].iter().copied());

    let values = vec![None, Some(1), Some(2), Some(3), Some(4)];
    let values = Arc::new(PrimitiveArray::from_iter(values.iter().copied()));

    let list_arr = ListArray::from_data(DataType::List(Box::new(Field::new("", DataType::Int32, true))), offsets.into(), values, Some(validity));

    // get a value from the list-array
    let sublist = list_arr.value(1);

    // compare that value with another array that not has an offset.
    let values = vec![2];
    let values = Arc::new(PrimitiveArray::from_iter(values.iter().copied().map(Some)));

    compare(&*sublist, &*values, Operator::Eq);
}
thread 'main' panicked at 'validity's bitmap offset must equal values offset', /home/ritchie46/.cargo/git/checkouts/arrow2-8a2ad61d97265680/4491954/src/array/boolean/mod.rs:49:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@ritchie46
Copy link
Collaborator Author

Fixed/ delayed by #552

@jorgecarleitao jorgecarleitao added bug Something isn't working no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog labels Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working no-changelog Issues whose changes are covered by a PR and thus should not be shown in the changelog
Projects
None yet
Development

No branches or pull requests

2 participants