Skip to content

Commit

Permalink
Merge pull request #108 from planetlabs/close-error
Browse files Browse the repository at this point in the history
Return any error after closing
  • Loading branch information
tschaub authored Oct 29, 2023
2 parents 8334081 + 6c1e8dd commit 7c9dec6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/pqutil/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ func TransformByColumn(config *TransformConfig) error {
}

fileWriter := file.NewParquetWriter(config.Writer, outputSchema.Root(), file.WithWriterProps(writerProperties))
defer fileWriter.Close()

ctx := pqarrow.NewArrowWriteContext(context.Background(), nil)

if config.RowGroupLength > 0 {
Expand Down Expand Up @@ -189,7 +187,9 @@ func TransformByColumn(config *TransformConfig) error {
}

if config.BeforeClose != nil {
return config.BeforeClose(fileReader, fileWriter)
if err := config.BeforeClose(fileReader, fileWriter); err != nil {
return err
}
}
return nil
return fileWriter.Close()
}

0 comments on commit 7c9dec6

Please sign in to comment.