alamb commented on issue #4472:
URL: https://github.com/apache/arrow-rs/issues/4472#issuecomment-1779764006

   @yukkit  is contemplating User Defined Types in DataFusion, and the arrow 
extension type mechanism is the obvious implementation I think -- see  
https://github.com/apache/arrow-datafusion/issues/7923
   
   > I personally think Field is the correct location for such metadata,
   
   @tustvold are you proposing something like the following? 
   
   ```rust
   enum DataType { 
   ....
      List(FieldRef),
      /// Extension type, with potentially embedded metadata in the field 
reference
      Extension(FieldRef)
   }
   ```
   
   This proposal runs afoul of how 
[`DataType::List`](https://docs.rs/arrow/latest/arrow/datatypes/enum.DataType.html#variant.List)
 works today (where the field name is mostly irrelevant ("item")), but I don't 
really have any better ideas. 
   
   I think this structure would allow @kylebarron  to implement
   
   ```rust
   impl TryFrom<&dyn Array> for GeometryArray {
     fn try_from(arr: &dyn Array>) -> Result<Self> {
       match arr.data_type() {
         DataType::Extension(field) if is_geo_type(field.metadata()) => {
           .... do the conversion ...
         }
         dt => Err("Unsupported datatype: {dt}
      }
   }
   ```


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