Skip to content

Commit 0478a39

Browse files
author
James Cor
committed
testing
1 parent 797f25f commit 0478a39

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

sql/aggregates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ type WindowFrame interface {
109109
StartCurrentRow() bool
110110
// EndCurrentRow returns whether a frame end is CURRENT ROW
111111
EndCurrentRow() bool
112-
// StartNFollowing returns a frame's start preceding Expression or nil
112+
// StartNPreceding returns a frame's start preceding Expression or nil
113113
StartNPreceding() Expression
114114
// StartNFollowing returns a frame's start following Expression or nil
115115
StartNFollowing() Expression

sql/rowexec/builder.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package rowexec
1616

1717
import (
1818
"runtime/trace"
19+
"sync"
1920

2021
"github.com/dolthub/go-mysql-server/sql"
2122
"github.com/dolthub/go-mysql-server/sql/plan"
@@ -58,3 +59,19 @@ func FinalizeIters(ctx *sql.Context, analyzed sql.Node, qFlags *sql.QueryFlags,
5859
iter = AddExpressionCloser(analyzed, iter)
5960
return iter, sch, nil
6061
}
62+
63+
// TODO: find a proper place for this
64+
var rowBuffers = sync.Pool{
65+
New: func() interface{} {
66+
return make(sql.Row, 0, 4096) // TODO: this is apparently max number of columns
67+
},
68+
}
69+
70+
func GetRow(length int) sql.Row {
71+
row := rowBuffers.Get().(sql.Row)
72+
return row[:length]
73+
}
74+
75+
func PutRow(row sql.Row) {
76+
rowBuffers.Put(row[:0])
77+
}

sql/rowexec/merge_join.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func newMergeJoinIter(ctx *sql.Context, b sql.NodeExecBuilder, j *plan.JoinNode,
4646
return nil, err
4747
}
4848

49-
fullRow := make(sql.Row, len(row)+len(j.Left().Schema())+len(j.Right().Schema()))
49+
fullRow := GetRow(len(row) + len(j.Left().Schema()) + len(j.Right().Schema()))
50+
// TODO: what is this for
5051
fullRow[0] = row
5152
if len(row) > 0 {
5253
copy(fullRow[0:], row[:])
@@ -586,5 +587,6 @@ func (i *mergeJoinIter) Close(ctx *sql.Context) (err error) {
586587
}
587588
}
588589

590+
PutRow(i.fullRow)
589591
return err
590592
}

sql/rows.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ package sql
1616

1717
import (
1818
"fmt"
19+
"github.com/dolthub/go-mysql-server/sql/values"
20+
"github.com/dolthub/vitess/go/vt/proto/query"
1921
"io"
2022
"strings"
21-
22-
"github.com/dolthub/vitess/go/vt/proto/query"
23-
24-
"github.com/dolthub/go-mysql-server/sql/values"
2523
)
2624

2725
// Row is a tuple of values.

0 commit comments

Comments
 (0)