codephage2020 opened a new issue, #9519:
URL: https://github.com/apache/arrow-rs/issues/9519

   #**Is your feature request related to a problem or challenge? Please 
describe what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)
   -->
   
https://github.com/apache/arrow-rs/blob/5ba451531efd2e98de38f6a8443aad605b6b5cc5/parquet-variant-compute/src/variant_get.rs#L273-L276
   
   Given data like:
   ```
   {"user": {"id": 123, "metadata": {"tags": ["a"], "score": 95.5}}}
   ```
   
   Users want to extract user with:
   
   - id as Int32
   - metadata as Variant (not expanded)
   
   Currently, this requires multiple variant_get calls and manual StructArray 
assembly.
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   
   Use  ExtensionType to mark fields that should remain as Variant:
   ``` rust
   let field = Field::new("user", DataType::Struct(Fields::from(vec![
       Field::new("id", DataType::Int32, true),
       Field::new("metadata", ..., true).with_extension_type(VariantType),  // 
Keep as Variant
   ])), true);
   
   let result = variant_get(&array, 
GetOptions::new().with_as_type(Some(Arc::new(field))))?;
   ```


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