Description
- Part of [EPIC] [Parquet] Implement Variant type support in Parquet #6736
- From [Variant] Improve write API in
Variant::Object
#7741
The above would certainly work, in the sense of producing a valid variant object. My only concern would be that the scenario almost certainly arises due to user error (which is quite different from a generic map or set), and silently tolerating that error isn't necessarily doing the user any favors in the long run. They'll just discover at read time that they lost data, instead of fast-failing at write time. We can probably get away with either approach -- silently replacing or loudly complaining -- I just want to be sure we make the choice intentionally.
Maybe we could have some flag that controls the validation behavior? Something like
let mut builder = VariantBuilder::new(); let mut obj = builder.new_object() // specify that an error should be thrown on repeated fields .with_validate_unique_fields() ... obj.finish()?; // this throws error if there were repeated fieldsThat way people could check for errors programmatically if they wanted to and could disable the checking if they didn't care 🤔
Originally posted by @alamb in #7741 (comment)
Describe the solution you'd like
Allow the user to configure insert validation behavior.