From f9c1dd14bf48516ed266b8fb2a8cc5a6232e4de4 Mon Sep 17 00:00:00 2001 From: Yiding Cui Date: Wed, 11 Sep 2024 09:27:51 +0800 Subject: [PATCH] session: set EnableWindowFunction for all SessionVars (#55991) (#55993) ref pingcap/tidb#55981 --- sessionctx/variable/session.go | 1 + sessionctx/variable/sysvar_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index d392c1de8f5a2..71fd2af162997 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -1960,6 +1960,7 @@ func NewSessionVars(hctx HookContext) *SessionVars { mppVersion: kv.MppVersionUnspecified, EnableLateMaterialization: DefTiDBOptEnableLateMaterialization, TiFlashComputeDispatchPolicy: tiflashcompute.DispatchPolicyConsistentHash, + EnableWindowFunction: DefEnableWindowFunction, } vars.KVVars = tikvstore.NewVariables(&vars.Killed) vars.Concurrency = Concurrency{ diff --git a/sessionctx/variable/sysvar_test.go b/sessionctx/variable/sysvar_test.go index 568d7a45691dd..a37ad725a8555 100644 --- a/sessionctx/variable/sysvar_test.go +++ b/sessionctx/variable/sysvar_test.go @@ -1238,3 +1238,14 @@ func TestTiDBEnableRowLevelChecksum(t *testing.T) { require.NoError(t, err) require.Equal(t, Off, val) } + +func TestEnableWindowFunction(t *testing.T) { + vars := NewSessionVars(nil) + require.Equal(t, vars.EnableWindowFunction, DefEnableWindowFunction) + require.NoError(t, vars.SetSystemVar(TiDBEnableWindowFunction, "on")) + require.Equal(t, vars.EnableWindowFunction, true) + require.NoError(t, vars.SetSystemVar(TiDBEnableWindowFunction, "0")) + require.Equal(t, vars.EnableWindowFunction, false) + require.NoError(t, vars.SetSystemVar(TiDBEnableWindowFunction, "1")) + require.Equal(t, vars.EnableWindowFunction, true) +}