viirya commented on code in PR #7843:
URL: https://github.com/apache/arrow-rs/pull/7843#discussion_r2178377349


##########
parquet-variant/src/builder.rs:
##########
@@ -698,6 +734,15 @@ impl<'a, 'b> ObjectBuilder<'a, 'b> {
     ///
     /// This consumes self and writes the object to the parent buffer.
     pub fn finish(mut self) -> Result<(), ArrowError> {

Review Comment:
   That's said, and, for the case these builders are in the same scope as the 
top-level builder, after this PR, if such a builder is not called `finish`, it 
will be caught by the compiler now, e.g.,
   
   ```
   error[E0505]: cannot move out of `builder` because it is borrowed
       --> parquet-variant/src/builder.rs:1510:9
        |
   1469 |         let mut builder = 
VariantBuilder::new().with_validate_unique_fields(true);
        |             ----------- binding `builder` declared here
   ...
   1485 |         let mut outer_list = builder.new_list();
        |                              ------- borrow of `builder` occurs here
   ...
   1510 |         builder.finish();
        |         ^^^^^^^ move out of `builder` occurs here
   1511 |     }
        |     - borrow might be used here, when `outer_list` is dropped and 
runs the `Drop` code for type `ListBuilder`
   ```



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