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

   > pub fn get_object_field(&self, field_name: &str) -> Option<Self> {
   >         match self {
   >             Variant::Object(object) => object.get(field_name),
   >             _ => None,
   >         }
   >     }
   > 
   >     
   >   
   > 
   > (plus the analagous `get_array_element` method)
   
   I think this API makes a lot of sense
   
   > > ### What should the "path" argument be? A String? A JSON path? Some 
structured thing (Vec)`?
   > 
   > ....
   > 
   > Overall, I would favor a `variant_get` that does "safe" casts only 
(widening, or lossless narrowing), as a compromise. Many engines will hopefully 
like that sane default, and those that find it too strict or too loose can 
always request variant and cast the result however they like.
   
   I think the API I sketeched out on the following issue is consistent with 
this plan
   - https://github.com/apache/arrow-rs/issues/7893
   
   If an engine wants to implement their own casting semantics, the will 
provide `None` to the API and the result with Variant and then they can do 
their own casting.
   
   If they want to cast as Arrow types they can use the existing kernel
   
   Though you bring up an excellent point -- given Variant has its own type 
system, supporting casts will require definining cast semantics for casting to 
Arrow types for all the variant types.
   
   However this seems like a reasonable low level primitive. 


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