S3 Select: optimize output (#8238)

Queue output items and reuse them.
Remove the unneeded type system in sql and just use the Go type system.

In best case this is more than an order of magnitude speedup:

```
BenchmarkSelectAll_1M-12    	       1	1841049400 ns/op	274299728 B/op	 4198522 allocs/op
BenchmarkSelectAll_1M-12    	      14	  84833400 ns/op	169228346 B/op	 3146541 allocs/op
```
This commit is contained in:
Klaus Post
2019-09-16 17:26:27 -07:00
committed by kannappanr
parent 017456df63
commit c9b8bd8de2
13 changed files with 556 additions and 231 deletions

View File

@@ -51,6 +51,24 @@ func (r *Record) Get(name string) (*sql.Value, error) {
return nil, errors.New("not implemented here")
}
// Reset the record.
func (r *Record) Reset() {
if len(r.KVS) > 0 {
r.KVS = r.KVS[:0]
}
}
// CopyFrom will copy all records from the incoming and append them to the existing records.
// The source record must be of a similar type.
func (r *Record) CopyFrom(record sql.Record) error {
other, ok := record.(*Record)
if !ok {
return fmt.Errorf("unexpected record type, expected %T, got %T", r, record)
}
r.KVS = append(r.KVS, other.KVS...)
return nil
}
// Set - sets the value for a column name.
func (r *Record) Set(name string, value *sql.Value) error {
var v interface{}