You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/22 05:44:25 UTC

[GitHub] [arrow-rs] HaoYang670 opened a new issue #1351: Refactor `StructArray::from`

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


   **Describe the bug**
   The function `StructArray::from` use `vec.push` in a for loop, which may cause many times of memory reallocation. What about using `Iterator::collect` Instead? Need your opinions.
   ```rust
   impl From<ArrayData> for StructArray {
       fn from(data: ArrayData) -> Self {
           let mut boxed_fields = vec![];
           for cd in data.child_data() {
               boxed_fields.push(make_array(cd.clone()));
           }
           Self { data, boxed_fields }
       }
   }
   ```
   https://github.com/apache/arrow-rs/blob/master/arrow/src/array/array_struct.rs#L110-L114
   
   **To Reproduce**
   None
   
   **Expected behavior**
   Avoid using `vec.push` in a for loop
   
   **Additional context**
   None
   


-- 
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] nevi-me closed issue #1351: Refactor `StructArray::from`

Posted by GitBox <gi...@apache.org>.
nevi-me closed issue #1351:
URL: https://github.com/apache/arrow-rs/issues/1351


   


-- 
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] HaoYang670 commented on issue #1351: Refactor `StructArray::from`

Posted by GitBox <gi...@apache.org>.
HaoYang670 commented on issue #1351:
URL: https://github.com/apache/arrow-rs/issues/1351#issuecomment-1048602240


   @alamb Is this refactoring worth doing?


-- 
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] HaoYang670 edited a comment on issue #1351: Refactor `StructArray::from`

Posted by GitBox <gi...@apache.org>.
HaoYang670 edited a comment on issue #1351:
URL: https://github.com/apache/arrow-rs/issues/1351#issuecomment-1048602240


   @alamb Is this refactoring worth to do?


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