-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
parquetChanges to the parquet crateChanges to the parquet crate
Description
Right now all code paths in ObjectBuilder and ListBuilder need to remember to call check_pending and we already have a bug related to this in #7786
It would be nice if we could get the Rust compiler to ensure this was done rather than relying on remembering to do it.
One idea is with an RAII like struct
I wonder if there is some sort of RAAI mechanism we can use to ensure that the pending field is completed automatically when the child ListBuilder or ObjectBuilder is dropped
That way the compiler can ensure this type of bug is not possible
Something like
/// If this is a builder for a nested object or list, on `Drop` this object will finish the
/// in progress field for the parent
enum PendingParent {
...
}
impl Drop for PendingParent {
List(...),
Object {
field_name: &str,
offset: usize
}
}Then we could create a field on the builder like this
struct ObjectBuilder {
...
pending: Option<PendingParent>,
}I think the biggest challenge would be sorting out the type lifetimes
Originally posted by @alamb in #7786 (comment)
Metadata
Metadata
Assignees
Labels
parquetChanges to the parquet crateChanges to the parquet crate