do not panic when input cannot be parsed (#13791)

Fix cases where `s3Select.Open` fails and doesn't set the recordReader.

Fixes #13786
This commit is contained in:
Klaus Post 2021-11-30 08:42:42 -08:00 committed by GitHub
parent 5a22f2cf0b
commit d6fe0f61a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,7 +369,7 @@ func (s3Select *S3Select) Open(getReader func(offset, length int64) (io.ReadClos
return err
}
panic(fmt.Errorf("unknown input format '%v'", s3Select.Input.format))
return fmt.Errorf("unknown input format '%v'", s3Select.Input.format)
}
func (s3Select *S3Select) marshal(buf *bytes.Buffer, record sql.Record) error {
@ -577,6 +577,9 @@ OuterLoop:
// Close - closes opened S3 object.
func (s3Select *S3Select) Close() error {
if s3Select.recordReader == nil {
return nil
}
return s3Select.recordReader.Close()
}