You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "friendlymatthew (via GitHub)" <gi...@apache.org> on 2025/06/26 00:07:01 UTC

[PR] [Variant] Check pending before `VariantObject::insert` [arrow-rs]

friendlymatthew opened a new pull request, #7786:
URL: https://github.com/apache/arrow-rs/pull/7786

   # Rationale for this change
   
   A follow up from https://github.com/apache/arrow-rs/pull/7778, we should make sure to check for pending fields before calling `ObjectBuilder::insert`
   
   


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Variant] Check pending before `VariantObject::insert` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #7786:
URL: https://github.com/apache/arrow-rs/pull/7786#discussion_r2167890060


##########
parquet-variant/src/builder.rs:
##########
@@ -597,29 +597,31 @@ impl<'a, 'b> ObjectBuilder<'a, 'b> {
         }
     }
 
+    fn check_pending_field(&mut self) {

Review Comment:
   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
   ```rust
   /// 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
   ```rust
   struct ObjectBuilder {
   ...
     pending: Option<PendingParent>,
   }
    ```
   
   I think the biggest challenge would be sorting out the type lifetimes
   



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Variant] Check pending before `VariantObject::insert` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #7786:
URL: https://github.com/apache/arrow-rs/pull/7786


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Variant] Check pending before `VariantObject::insert` [arrow-rs]

Posted by "friendlymatthew (via GitHub)" <gi...@apache.org>.
friendlymatthew commented on code in PR #7786:
URL: https://github.com/apache/arrow-rs/pull/7786#discussion_r2167899495


##########
parquet-variant/src/builder.rs:
##########
@@ -597,29 +597,31 @@ impl<'a, 'b> ObjectBuilder<'a, 'b> {
         }
     }
 
+    fn check_pending_field(&mut self) {

Review Comment:
   Interesting, I can take a stab at this



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org