You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ne...@apache.org on 2022/02/24 07:38:55 UTC
[arrow-rs] branch master updated: Refactor `StructArray::from` (#1360)
This is an automated email from the ASF dual-hosted git repository.
nevime pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 57545b0 Refactor `StructArray::from` (#1360)
57545b0 is described below
commit 57545b01f4a784b38a2fdaeda0cfefb4ccbdc5de
Author: Remzi Yang <59...@users.noreply.github.com>
AuthorDate: Thu Feb 24 15:38:49 2022 +0800
Refactor `StructArray::from` (#1360)
* add async to default features
Signed-off-by: remzi <13...@gmail.com>
* rewrite
Signed-off-by: remzi <13...@gmail.com>
* update
Signed-off-by: remzi <13...@gmail.com>
---
arrow/src/array/array_struct.rs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arrow/src/array/array_struct.rs b/arrow/src/array/array_struct.rs
index 316ffc6..b82ee03 100644
--- a/arrow/src/array/array_struct.rs
+++ b/arrow/src/array/array_struct.rs
@@ -108,10 +108,12 @@ impl StructArray {
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()));
- }
+ let boxed_fields = data
+ .child_data()
+ .iter()
+ .map(|cd| make_array(cd.clone()))
+ .collect();
+
Self { data, boxed_fields }
}
}