You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Andrew Lamb (Jira)" <ji...@apache.org> on 2021/04/26 11:25:07 UTC

[jira] [Commented] (ARROW-7700) [Rust] All array types should have iterators and FromIterator support.

    [ https://issues.apache.org/jira/browse/ARROW-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17332044#comment-17332044 ] 

Andrew Lamb commented on ARROW-7700:
------------------------------------

Migrated to github: https://github.com/apache/arrow-rs/issues/60

> [Rust] All array types should have iterators and FromIterator support.
> ----------------------------------------------------------------------
>
>                 Key: ARROW-7700
>                 URL: https://issues.apache.org/jira/browse/ARROW-7700
>             Project: Apache Arrow
>          Issue Type: Wish
>          Components: Rust
>            Reporter: Andy Thomason
>            Priority: Major
>              Labels: Usability
>
> 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 message was sent by Atlassian Jira
(v8.3.4#803005)