mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -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:
@@ -219,11 +219,11 @@ func (e *SelectStatement) AggregateRow(input Record) error {
|
||||
|
||||
// Eval - evaluates the Select statement for the given record. It
|
||||
// applies only to non-aggregation queries.
|
||||
func (e *SelectStatement) Eval(input, output Record) (Record, error) {
|
||||
func (e *SelectStatement) Eval(input, output Record) error {
|
||||
ok, err := e.isPassingWhereClause(input)
|
||||
if err != nil || !ok {
|
||||
// Either error or row did not pass where clause
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
if e.selectAST.Expression.All {
|
||||
@@ -234,14 +234,13 @@ func (e *SelectStatement) Eval(input, output Record) (Record, error) {
|
||||
if e.limitValue > -1 {
|
||||
e.outputCount++
|
||||
}
|
||||
|
||||
return input, nil
|
||||
return output.CopyFrom(input)
|
||||
}
|
||||
|
||||
for i, expr := range e.selectAST.Expression.Expressions {
|
||||
v, err := expr.evalNode(input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
// Pick output column names
|
||||
@@ -259,7 +258,7 @@ func (e *SelectStatement) Eval(input, output Record) (Record, error) {
|
||||
e.outputCount++
|
||||
}
|
||||
|
||||
return output, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// LimitReached - returns true if the number of records output has
|
||||
|
||||
Reference in New Issue
Block a user