mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
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:
@@ -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{}
|
||||
|
||||
Reference in New Issue
Block a user