zeroshade commented on code in PR #1047:
URL: https://github.com/apache/arrow-go/pull/1047#discussion_r3722281203


##########
arrow/ipc/writer.go:
##########
@@ -148,24 +165,38 @@ func (w *Writer) Close() error {
        }
 
        err := w.pw.Close()
+       w.pw = nil
+       w.releaseDictionaries()
        if err != nil {
-               return fmt.Errorf("arrow/ipc: could not close payload writer: 
%w", err)
+               return w.fail(fmt.Errorf("arrow/ipc: could not close payload 
writer: %w", err))
        }
-       w.pw = nil
 
+       return nil
+}
+
+func (w *Writer) releaseDictionaries() {
        for _, d := range w.lastWrittenDicts {
                d.Release()
        }
+       w.lastWrittenDicts = nil
+}
 
-       return nil
+func (w *Writer) fail(err error) error {
+       if w.err == nil {
+               w.err = err
+       }
+       return w.err

Review Comment:
   that's fair, we can leave it for now



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