viirya commented on issue #1425:
URL: https://github.com/apache/arrow-rs/issues/1425#issuecomment-1065804687


   > > > The idea is we don't need to Clone, why bother? As in your Java 
program you need to hold the pointer as long as you need it, and can only free 
it when the job is done.
   > > 
   > > 
   > > Are you sure it works?
   > > ```
   > > error[E0507]: cannot move out of `*array` which is behind a raw pointer
   > > ...
   > > error[E0507]: cannot move out of `*schema` which is behind a raw pointer
   > > ```
   > 
   > How you run the code? From my side:
   > 
   > ```rust
   > ✘ 🍻   ~/github/arrow-rs/arrow   flight-sql-client ±  cargo test -- 
--nocapture test_clone_array_segfault_on_drop
   >    Compiling arrow v10.0.0 (/Users/wangfenjin/github/arrow-rs/arrow)
   >     Finished test [unoptimized + debuginfo] target(s) in 41.79s
   >      Running unittests 
(/Users/wangfenjin/github/arrow-rs/target/debug/deps/arrow-01a41b09de9e05da)
   > 
   > running 1 test
   > error: test failed, to rerun pass '--lib'
   > 
   > Caused by:
   >   process didn't exit successfully: 
`/Users/wangfenjin/github/arrow-rs/target/debug/deps/arrow-01a41b09de9e05da 
--nocapture test_clone_array_segfault_on_drop` (signal: 11, SIGSEGV: invalid 
memory reference)
   > ```
   
   I mean the solution you suggested:
   
   ```
   Ok(Self {
               array: Arc::new(*array), // notice we don't need to clone here, 
if will also solve your problem
               schema: Arc::new(*schema),
           })
   ```


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

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


Reply via email to