superserious-dev commented on PR #8179:
URL: https://github.com/apache/arrow-rs/pull/8179#issuecomment-3234315990

   > > > Can use `variant_get` for shredded numeric types
   > > 
   > > 
   > > What happens if `variant_get` encounters a `typed_value: LONG` at the 
requested path, but the caller requested `Some(Int32)` type that doesn't match? 
Is there code somewhere else to handle the casting? (I don't see any unit tests 
that cover the case, either)
   > 
   > Any thoughts on this, @superserious-dev ?
   
   Currently this PR only covers the case where the user has not requested a 
specific output type. I noticed there was a separate issue/discussion 
https://github.com/apache/arrow-rs/issues/8086 for casting, so I didn't 
implement it here. However I'd be fine with amending this PR to include the 
casting behavior for numeric types, if that is preferred.
   
   For reference, the code for determining typed output(`as_type` is not None) 
vs. variant output(`as_type` is None) is here:
   
https://github.com/apache/arrow-rs/blob/21a9a2ad5f047d08883fd7589b2053cdd9b56626/parquet-variant-compute/src/variant_get/output/mod.rs#L63-L87
 and it's called in `variant_get` here: 
https://github.com/apache/arrow-rs/blob/1dacecba8e11cac307eea5d1a0f10c22d7f4a8b7/parquet-variant-compute/src/variant_get/mod.rs#L45
   There's a set of pre-existing tests that cover the specific case of int32 -> 
int32. This could be macro-ified for coverage of all the different combinations 
of numeric types, eg. int32->int64. 
https://github.com/apache/arrow-rs/blob/1dacecba8e11cac307eea5d1a0f10c22d7f4a8b7/parquet-variant-compute/src/variant_get/mod.rs#L223-L259
   
   


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