jayzhan211 commented on PR #9595:
URL: 
https://github.com/apache/arrow-datafusion/pull/9595#issuecomment-2016648195

   I found it difficult to cleanup the tuple into DFField struct because there 
4 kinds of combination I need to construct.
   
   Normal case
   ```rust
   pub struct DFFieldRef<'a> {
       /// Optional qualifier (usually a table or relation name)
       qualifier: Option<&'a OwnedTableReference>,
       /// Arrow field definition
       field: &'a Field,
   }
   ```
   
   Sometimes we need FieldRef to avoid the cost of clone for field.
   ```rust
   pub struct DFFieldRefWithArc<'a> {
       /// Optional qualifier (usually a table or relation name)
       qualifier: Option<&'a OwnedTableReference>,
       /// Arrow field definition
       field: &'a FieldRef,
   }
   ```
   
   It is *usually* easier to deal with owned dffield sometimes without 
additional cost, because we can't avoid clone for `Schema::new_with_metadata`
   ```rust
   pub struct DFField {
       /// Optional qualifier (usually a table or relation name)
       pub qualifier: Option<OwnedTableReference>,
       /// Arrow field definition
       pub field: FieldRef,
   }
   ```
   
   And of course, we have field not fieldRef, it seems better not to wrap it 
with Arc if possible.
   ```rust
   pub struct DFField {
       /// Optional qualifier (usually a table or relation name)
       pub qualifier: Option<OwnedTableReference>,
       /// Arrow field definition
       pub field: FieldRef,
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to