alamb opened a new issue #60:
URL: https://github.com/apache/arrow-rs/issues/60


   *Note*: migrated from original JIRA: 
https://issues.apache.org/jira/browse/ARROW-7700
   
   Array types should have an Iterable trait that generates plain or nullable 
iterators.
   
   
   {code}
   pub trait Iterable<'a>
   where Self::IterType: std::iter::Iterator
   {
       type IterType;
   
       fn iter(&'a self) -> Self::IterType;
       fn iter_nulls(&'a self) -> NullableIterator<Self::IterType>;
   }
   {code}
   
   IterType depends on the array type from standard slice iterators for 
primitive types, string iterators for UTF8 types and composite iterators 
(generating other iterators) for list, struct and dictionary types.
   
   The NullableIterator type should bundle a null bitmap pointer with another 
iterator type to form a composite iterator that returns an option:
   
   {code}
   /// Convert any iterator to a nullable iterator by using the null bitmap.
   #[derive(Debug, PartialEq, Clone)]
   pub struct NullableIterator<T: Iterator> {
       iter: T,
       i: usize,
       null_bitmap: *const u8,
   }
   
   impl<T: Iterator> NullableIterator<T> {
       fn from(iter: T, null_bitmap: &Option<Bitmap>, offset: usize) -> Self;
   }
   {code}
   
   For more details, some exploratory work has been done here: 
https://github.com/andy-thomason/arrow/blob/ARROW-iterators/rust/arrow/src/array/array.rs#L1711


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to