Skip to content

Commit 4f7242d

Browse files
committed
executor: rename ordered window helper
1 parent f00db4e commit 4f7242d

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

pkg/executor/windows/builder.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ import (
2727
"github.com/pingcap/tidb/pkg/sessionctx"
2828
)
2929

30-
// BuildStream constructs the executor for a stream window physical plan. The
31-
// caller must ensure that the child already provides the required order.
32-
func BuildStream(sctx sessionctx.Context, v *physicalop.PhysicalWindow, childExec exec.Executor) (exec.Executor, error) {
30+
// BuildOrdered constructs the executor for a window plan whose child already
31+
// provides the required partition/order property.
32+
func BuildOrdered(sctx sessionctx.Context, v *physicalop.PhysicalWindow, childExec exec.Executor) (exec.Executor, error) {
3333
windowExec, err := Build(sctx, v, childExec, true)
3434
if err != nil {
3535
return nil, err
3636
}
3737
pipelinedExec, ok := windowExec.(*PipelinedWindowExec)
3838
if !ok {
39-
return nil, errors.New("stream window must be built with pipelined window executor")
39+
return nil, errors.New("ordered window must be built with pipelined window executor")
4040
}
41-
return &StreamWindowExec{PipelinedWindowExec: pipelinedExec}, nil
41+
return &OrderedWindowExec{PipelinedWindowExec: pipelinedExec}, nil
4242
}
4343

4444
// Build constructs the concrete executor for a window physical plan.

pkg/executor/windows/pipelined_window.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ type PipelinedWindowExec struct {
7777
initializedSlidingWindow bool
7878
}
7979

80-
// StreamWindowExec executes windows whose input already satisfies the required
80+
// OrderedWindowExec executes windows whose input already satisfies the required
8181
// partition/order property.
82-
type StreamWindowExec struct {
82+
type OrderedWindowExec struct {
8383
*PipelinedWindowExec
8484
}
8585

pkg/executor/windows/window_executor_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestWindowExecutorsBasic(t *testing.T) {
5656
}
5757
}
5858

59-
func TestBuildStreamWindowExec(t *testing.T) {
59+
func TestBuildOrderedWindowExec(t *testing.T) {
6060
store := testkit.CreateMockStore(t)
6161
tk := testkit.NewTestKit(t, store)
6262
tk.MustExec("set @@tidb_enable_pipelined_window_function = 0")
@@ -83,20 +83,20 @@ func TestBuildStreamWindowExec(t *testing.T) {
8383
windowSchema.Append(&expression.Column{Index: 2, UniqueID: 3, RetType: types.NewFieldType(mysql.TypeLonglong)})
8484
windowPlan := physicalWindowForTest(sctx.GetPlanCtx(), windowSchema, colA, colB, windowFunc)
8585

86-
streamExec, err := windowexec.BuildStream(sctx, windowPlan, childExec)
86+
orderedExec, err := windowexec.BuildOrdered(sctx, windowPlan, childExec)
8787
require.NoError(t, err)
88-
require.IsType(t, &windowexec.StreamWindowExec{}, streamExec)
88+
require.IsType(t, &windowexec.OrderedWindowExec{}, orderedExec)
8989

9090
ctx := context.Background()
91-
require.NoError(t, streamExec.Open(ctx))
91+
require.NoError(t, orderedExec.Open(ctx))
9292
defer func() {
93-
require.NoError(t, streamExec.Close())
93+
require.NoError(t, orderedExec.Close())
9494
}()
9595

96-
chk := exec.NewFirstChunk(streamExec)
96+
chk := exec.NewFirstChunk(orderedExec)
9797
rows := make([]string, 0, 4)
9898
for {
99-
require.NoError(t, streamExec.Next(ctx, chk))
99+
require.NoError(t, orderedExec.Next(ctx, chk))
100100
if chk.NumRows() == 0 {
101101
break
102102
}

0 commit comments

Comments
 (0)