alamb commented on code in PR #8105:
URL: https://github.com/apache/arrow-rs/pull/8105#discussion_r2274349811


##########
parquet-variant-compute/src/variant_array.rs:
##########
@@ -337,6 +339,9 @@ fn typed_value_to_variant(typed_value: &ArrayRef, index: 
usize) -> Variant<'_, '
             let typed_value = typed_value.as_primitive::<Int32Type>();
             Variant::from(typed_value.value(index))
         }
+        DataType::Int16 => {

Review Comment:
   looks good -- we can probably change the `DataType::Int32` branch to use 
this macro too, right?
   
   Also, I think we should add a test



##########
parquet-variant-compute/src/lib.rs:
##########
@@ -47,3 +47,26 @@ pub use variant_array_builder::{VariantArrayBuilder, 
VariantArrayVariantBuilder}
 
 pub use from_json::batch_json_string_to_variant;
 pub use to_json::batch_variant_to_json_string;
+
+/// Convert the input array to a `VariantArray` row by row, using `method`
+/// to downcast the generic array to a specific array type and `cast_fn`
+/// to transform each element to a type compatible with Variant

Review Comment:
   this is an interesting idea -- to have two variations of each macro. It is 
probably a reasonable place to start
   
   However, I think it would be nice to avoid having macros in the root 
`lib.rs` file -- what do you think about making a new module like 
`parquet-variant-compute/src/arrow_types.rs` or 
`parquet-variant-compute/src/type_conversion.rs` to hold the code to convert 
back and forth between Arrow types and Variant types 
   
   
   @scovich added similar code in `VariantToPrimitive` here: 
https://github.com/apache/arrow-rs/pull/8122
   
   So I am thinking having a module to start collecting such code would be 
useful



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