s3Select: call Close on error to release the read lock (#7830)

master
Yao Zongyou 5 years ago committed by kannappanr
parent 55092bede1
commit 941fed8e4a
  1. 3
      pkg/s3select/select.go

@ -272,11 +272,13 @@ func (s3Select *S3Select) Open(getReader func(offset, length int64) (io.ReadClos
s3Select.progressReader, err = newProgressReader(rc, s3Select.Input.CompressionType) s3Select.progressReader, err = newProgressReader(rc, s3Select.Input.CompressionType)
if err != nil { if err != nil {
rc.Close()
return err return err
} }
s3Select.recordReader, err = csv.NewReader(s3Select.progressReader, &s3Select.Input.CSVArgs) s3Select.recordReader, err = csv.NewReader(s3Select.progressReader, &s3Select.Input.CSVArgs)
if err != nil { if err != nil {
rc.Close()
return err return err
} }
@ -289,6 +291,7 @@ func (s3Select *S3Select) Open(getReader func(offset, length int64) (io.ReadClos
s3Select.progressReader, err = newProgressReader(rc, s3Select.Input.CompressionType) s3Select.progressReader, err = newProgressReader(rc, s3Select.Input.CompressionType)
if err != nil { if err != nil {
rc.Close()
return err return err
} }

Loading…
Cancel
Save