liyongjing opened a new issue, #1969:
URL: https://github.com/apache/arrow-rs/issues/1969

   **Describe the bug**
   A clear and concise description of what the bug is.
   ```rust
   use super::builder;
   use arrow::record_batch::RecordBatch;
   use parquet::{
       arrow::ArrowWriter,
       basic::Compression,
       file::properties::{WriterProperties, WriterVersion},
   };
   use std::{fs::File, path::Path};
   
   pub struct Writer {
       writer: ArrowWriter<File>,
   }
   
   impl Writer {
       pub fn new<P: AsRef<Path>>(path: P) -> Self {
           let schema = builder::get_schema();
           let file = File::create(&path).unwrap();
           let props = WriterProperties::builder().build();
           let writer = ArrowWriter::try_new(file, schema, 
Some(props)).unwrap();
           Self { writer }
       }
   
       pub fn write(&mut self, batch: &RecordBatch) {
           self.writer.write(batch).expect("Writing batch");
       }
   
       pub fn close(&mut self) {
           // writer must be closed to write footer
           self.writer.close().unwrap();
       }
   }
   
   ```
   
   **To Reproduce**
   Steps to reproduce the behavior:
   ```
      |         self.writer.close().unwrap();
      |         ^^^^^^^^^^^ move occurs because `self.writer` has type 
`ArrowWriter<std::fs::File>`, which does not implement the `Copy` trait
   ```
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   `write` and `close` use the same parameters
   
   
   parquet-17.0.0/src/arrow/arrow_writer/mod.rs 222 line
   ```rust
       /// Close and finalize the underlying Parquet writer
       pub fn close(&mut self) -> Result<parquet_format::FileMetaData> {
           self.flush()?;
           self.writer.close()
       }
   ```
   parquet-17.0.0/src/file/writer.rs 167 line
   ```rust
       pub fn close(&mut self) -> Result<parquet::FileMetaData> {
           self.assert_previous_writer_closed()?;
           let metadata = self.write_metadata()?;
           Ok(metadata)
       }
   ```
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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.apache.org

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

Reply via email to