You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ag...@apache.org on 2021/03/12 20:13:37 UTC

[arrow] branch maint-3.0.x updated: ARROW-11681: [Rust] Don't unwrap in IPC writers

This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch maint-3.0.x
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/maint-3.0.x by this push:
     new bb5f305  ARROW-11681: [Rust] Don't unwrap in IPC writers
bb5f305 is described below

commit bb5f3057db1d5b9514954f75b6bf64b43bcfd1a3
Author: Steven Fackler <sf...@gmail.com>
AuthorDate: Sat Feb 20 08:44:22 2021 -0500

    ARROW-11681: [Rust] Don't unwrap in IPC writers
    
    A common reason a writer would be dropping without finishing is because
    the underlying stream returned an earlier error. In that case, the
    destructor will probably also encounter an error, resulting in a panic.
    Instead just ignore the result from finish, mirroring the behavior of
    the standard library's BufWriter.
    
    Closes #9520 from sfackler/ipc-panic
    
    Authored-by: Steven Fackler <sf...@gmail.com>
    Signed-off-by: Andrew Lamb <an...@nerdnetworks.org>
---
 rust/arrow/src/ipc/writer.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/arrow/src/ipc/writer.rs b/rust/arrow/src/ipc/writer.rs
index 688829a..bc5e4cc 100644
--- a/rust/arrow/src/ipc/writer.rs
+++ b/rust/arrow/src/ipc/writer.rs
@@ -460,7 +460,7 @@ impl<W: Write> FileWriter<W> {
 impl<W: Write> Drop for FileWriter<W> {
     fn drop(&mut self) {
         if !self.finished {
-            self.finish().unwrap();
+            let _ = self.finish();
         }
     }
 }
@@ -542,7 +542,7 @@ impl<W: Write> StreamWriter<W> {
 impl<W: Write> Drop for StreamWriter<W> {
     fn drop(&mut self) {
         if !self.finished {
-            self.finish().unwrap();
+            let _ = self.finish();
         }
     }
 }