fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368590476


##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
                 .zip(other.iter())
                 .all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
     }
+
+    pub fn reverse(&mut self) {
+        let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as 
FieldRef).collect();
+        self.0 = Arc::new(new_fields);
+    }
+
+    pub fn push(&mut self, field: Field) {

Review Comment:
   
   > I think the better question is, why not use SchemaBuilder, it will be 
faster, less complicated, and avoid having to make changes to Fields?
   
   The problem is that the transformation of Fields into SchemaBuilder appears 
to be performance intensive.
   Here it look like we can only use
   ```rust
   SchemaBuilder::from(self.clone());
   ```
   The result could be something like this:
   ```Rust
       pub fn push(&mut self, field: Field) {
           let mut new_fields = SchemaBuilder::from(self.clone());
           new_fields.push(field);
           *self = new_fields.finish().fields;
       }
   ```
   I am not sure why `ShemaBuilder` is better than old?
   
   



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to