S3 select: Fix output conversion on select * (#8303)

Fixes #8268
This commit is contained in:
Klaus Post
2019-09-27 12:33:14 -07:00
committed by Harshavardhana
parent 4155f4e49b
commit 1c5b05c130
6 changed files with 78 additions and 29 deletions

View File

@@ -74,18 +74,21 @@ func (r *Record) Reset() {
}
}
// CopyFrom will copy all records from the incoming and append them to the existing records.
// The source record must be of a similar type.
// Note that the lookup index is not copied.
func (r *Record) CopyFrom(record sql.Record) error {
other, ok := record.(*Record)
// Clone the record.
func (r *Record) Clone(dst sql.Record) sql.Record {
other, ok := dst.(*Record)
if !ok {
return fmt.Errorf("unexpected record type, expected %T, got %T", r, record)
other = &Record{}
}
//before := len(r.csvRecord)
r.columnNames = append(r.columnNames, other.columnNames...)
r.csvRecord = append(r.csvRecord, other.csvRecord...)
return nil
if len(other.columnNames) > 0 {
other.columnNames = other.columnNames[:0]
}
if len(other.csvRecord) > 0 {
other.csvRecord = other.csvRecord[:0]
}
other.columnNames = append(other.columnNames, r.columnNames...)
other.csvRecord = append(other.csvRecord, r.csvRecord...)
return other
}
// WriteCSV - encodes to CSV data.