Skip to content

Commit

Permalink
session: set EnableWindowFunction for all SessionVars (#55991)
Browse files Browse the repository at this point in the history
close #55981
  • Loading branch information
winoros authored Sep 10, 2024
1 parent 76098f5 commit 2c30f86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1187,10 +1187,6 @@ func createSessionFunc(store kv.Storage) pools.Factory {
if err != nil {
return nil, errors.Trace(err)
}
err = se.sessionVars.SetSystemVar(variable.TiDBEnableWindowFunction, variable.BoolToOnOff(variable.DefEnableWindowFunction))
if err != nil {
return nil, errors.Trace(err)
}
err = se.sessionVars.SetSystemVar(variable.TiDBConstraintCheckInPlacePessimistic, variable.On)
if err != nil {
return nil, errors.Trace(err)
Expand Down
1 change: 1 addition & 0 deletions pkg/sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,7 @@ func NewSessionVars(hctx HookContext) *SessionVars {
DefaultCollationForUTF8MB4: mysql.DefaultCollationName,
GroupConcatMaxLen: DefGroupConcatMaxLen,
EnableRedactLog: DefTiDBRedactLog,
EnableWindowFunction: DefEnableWindowFunction,
}
vars.status.Store(uint32(mysql.ServerStatusAutocommit))
vars.StmtCtx.ResourceGroupName = resourcegroup.DefaultResourceGroupName
Expand Down
11 changes: 11 additions & 0 deletions pkg/sessionctx/variable/sysvar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,17 @@ func TestTiDBSchemaCacheSize(t *testing.T) {
require.Error(t, err)
}

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)
}

func TestTiDBAutoAnalyzeConcurrencyValidation(t *testing.T) {
vars := NewSessionVars(nil)

Expand Down

0 comments on commit 2c30f86

Please sign in to comment.