You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/20 20:10:17 UTC

[GitHub] [arrow-rs] alamb opened a new pull request, #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

alamb opened a new pull request, #3891:
URL: https://github.com/apache/arrow-rs/pull/3891

   # Which issue does this PR close?
   
   N/A
   
   # Rationale for this change
    
   I was initially confused about this API and @appletreeisyellow also asked about it on https://github.com/influxdata/influxdb_iox/pull/7198g#discussion_r1142581652. 
   
   The docs don't help much https://docs.rs/arrow/35.0.0/arrow/array/struct.GenericListBuilder.html
   
   Thus I conclude more documentation is in order
   
   # What changes are included in this PR?
   
   Add doc comments
   
   # Are there any user-facing changes?
   Docs / examples
   


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] tustvold merged pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1143200970


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   Confirmed
   
   - https://github.com/apache/arrow-rs/blob/master/arrow-cast/src/pretty.rs#L291
   - https://github.com/apache/arrow-rs/blob/master/arrow-json/src/raw/mod.rs#L668
   
   Although I do realise our test coverage of this is fairly limited...
   
   That looks like the output of a UnionArray tbh?
   
   



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1143295661


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   will update to match pretty output



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1142724027


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   Are you sure that isn't some IOx specific thing, the ArrayFormatter definitely should be using [



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1142684307


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   Perhaps [ might be more obvious than {, which would suggest an object



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1142711327


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   It is a good idea. I chose the `{` notation because it is what is used in the pretty print output for ListArray
   
   For example:
   
   https://github.com/influxdata/influxdb_iox/blob/efae5246cf1f2cc13222593f669dc4af3039d0df/influxdb_iox/tests/end_to_end_cases/flightsql.rs#L184-L192
   
   SHould I propose changing that too?



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1145271803


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   https://github.com/apache/arrow-rs/blob/0e80ce601299977c4373e75c5d0d6c8350c5ddd9/arrow-cast/src/pretty.rs#L291-L321 shows the pretty format for a fixed size list. 
   
   I didn't find any test for a non fixed size list, so I will add one as well as part of a follow on PR



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #3891: Minor: add examples for `ListBuilder` and `GenericListBuilder`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #3891:
URL: https://github.com/apache/arrow-rs/pull/3891#discussion_r1145276040


##########
arrow-array/src/builder/mod.rs:
##########
@@ -132,9 +132,70 @@ pub trait ArrayBuilder: Any + Send {
     fn into_box_any(self: Box<Self>) -> Box<dyn Any>;
 }
 
-/// A list array builder with i32 offsets
+/// Builder for [`ListArray`]s (i32 offsets)
+///
+/// [`ListArray`]: crate::array::ListArray
+///
+/// # Example
+///
+/// ```
+/// # use arrow_array::builder::{StringBuilder, ListBuilder};
+/// # use arrow_array::ListArray;
+/// // Build a 3 element array of lists:
+/// //
+/// // column
+/// // ---------
+/// // {one},

Review Comment:
   ![Screenshot 2023-03-22 at 2 56 25 PM](https://user-images.githubusercontent.com/490673/227008682-b547b401-cd6f-4893-8b0f-0b543dd622cf.png)
   Looks good now -- thank you for the suggestion



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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