-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Version: github.com/apache/arrow-go/v18 v18.5.2
pqarrow.NewFileWriter accepts an io.Writer, but FileWriter.Close() internally calls TellWrapper.Close() which performs a runtime type assertion and calls Close() on the underlying writer if it satisfies io.WriteCloser.
This violates the established Go convention that a writer accepting io.Writer does not own the sink's lifetime. Both gzip.Writer and bufio.Writer write their format trailers in Close() but explicitly leave the underlying io.Writer open — the caller who created the sink is responsible for closing it.
Suggested fix: Remove the Close call from TellWrapper.Close(). If closing the underlying writer is intentional, NewFileWriter should accept io.WriteCloser explicitly so the contract is visible to callers.
Component(s)
Parquet