Skip to content

Commit

Permalink
Implement LogicalValidity for ChunkedArray (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 authored Aug 20, 2024
1 parent cbe9f01 commit ee1f7ae
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions vortex-array/src/array/chunked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::iter::{ArrayIterator, ArrayIteratorAdapter};
use crate::stats::StatsSet;
use crate::stream::{ArrayStream, ArrayStreamAdapter};
use crate::validity::Validity::NonNullable;
use crate::validity::{ArrayValidity, LogicalValidity};
use crate::validity::{ArrayValidity, LogicalValidity, Validity};
use crate::visitor::{AcceptArrayVisitor, ArrayVisitor};
use crate::{impl_encoding, Array, ArrayDType, ArrayDef, ArrayTrait, IntoArray};

Expand Down Expand Up @@ -157,12 +157,19 @@ impl AcceptArrayVisitor for ChunkedArray {
}

impl ArrayValidity for ChunkedArray {
fn is_valid(&self, _index: usize) -> bool {
todo!()
fn is_valid(&self, index: usize) -> bool {
let (chunk, offset_in_chunk) = self.find_chunk_idx(index);
self.chunk(chunk)
.expect("must be a valid chunk index")
.with_dyn(|a| a.is_valid(offset_in_chunk))
}

fn logical_validity(&self) -> LogicalValidity {
todo!()
let validity: Validity = self
.chunks()
.map(|a| a.with_dyn(|arr| arr.logical_validity()))
.collect();
validity.to_logical(self.len())
}
}

Expand Down

0 comments on commit ee1f7ae

Please sign in to comment.