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

   > It would be better to provide two append functions: one that includes 
validation and returns an error, and another without validation. 🤔
   
   Another approach that @friendlymatthew @scovich and I came up with in 
https://github.com/apache/arrow-rs/pull/7718 was to introduce a "newtype" 
wrapper that validated on construction (and this prevents invalid Variant's 
from being constructed)
   
   For example, for Decimal we could introduce 
   ```rust
   enum Variant {
   ..
     Decimal4(VariantDecimal4)
   ..
   }
   ```
   
   Where `VaraintDecimal4::try_new` did the validation for precision /scale
   
   That would avoid having any error path in the builder and I think be eaiser 
to reason about
   
   What do you think @Weijun-H ?


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